Questions tagged [basic]

For questions about the BASIC (Beginner’s All-purpose Symbolic Instruction Code) programming language. DO NOT USE TO INDICATE YOUR QUESTION IS SIMPLE!

BASIC, short for Beginner's All-purpose Symbolic Instruction Code, is a family of high-level programming languages popular in the 1980s, and emphasizes on the ease of use. This language and the tag is not to be confused with Visual Basic.

The first version of BASIC was developed on May 1st, 1964 by John G. Kemeny, Thomas E. Kurtz and Mary Kenneth Keller in Dartmouth College. Since then, it encouraged students and enthusiasts from backgrounds other than sciences and mathematics to create their own programs and many microcomputers of the 1980s came pre-loaded with BASIC. Later, many other programming languages heavily influenced by BASIC has been developed, with several still in use, such as Visual Basic and VB.NET.

Here is an example of a sample qBASIC program (one BASIC variety), which prints "Hello World", uses a for loop to print out number multipliers, then squares a number variable, asks for name input, and then repeatedly asks for number input until the user enters a negative number. The text after // are not part of the code.

10 PRINT "HELLO WORLD" // Hello World
20 FOR X=1 TO 5        // For Loop
30 PRINT "X "; X
40 NEXT X
50 LET A = 10          // Square variable
55 LET B = A*A
60 PRINT A;"^2 = ";B
70 PRINT "ENTER YOUR NAME"            // Enter name
75 INPUT "Enter your name:"; a$
80 PRINT "My name is "; a$
90 PRINT "ENTER A NUMBER, 0 TO CLOSE" // Repeatedly enter number
95 INPUT "Enter a number:"; a$
100 PRINT "The number is "; a$
110 IF a$ >= 0 THEN GOTO 90
999 END

An example output is:

HELLO WORLD
X 1
X 2
X 3
X 4
X 5
10^2 = 100
ENTER YOUR NAME
My name is I am a basic programmer!
ENTER A NUMBER, 0 TO CLOSE
The number is 5
ENTER A NUMBER, 0 TO CLOSE
The number is 4
ENTER A NUMBER, 0 TO CLOSE
The number is 3
ENTER A NUMBER, 0 TO CLOSE
The number is 2
ENTER A NUMBER, 0 TO CLOSE
The number is 1
ENTER A NUMBER, 0 TO CLOSE
The number is 0
ENTER A NUMBER, 0 TO CLOSE
The number is -1

Read More

  • Visual Basic for Applications, usually for writing macros for Microsoft Office.
  • One of the main languages of the .NET Framework. It is not the same as VBA.
  • Wikipedia
  • Online BASIC simulator
855 questions
-3
votes
1 answer

Second Pair of Eyes required for VB Logic Issue

Everything works! Except the FOR LOOP that calculates the third column in my Results (4,2) array. Interface Design: The loop will not run! Each line works outside of the loop but I've been staring at this all afternoon. Would be very grateful if…
-3
votes
2 answers

how to add an X=msgbox command using sendkeys vbs

when I try adding the " quotes in X=msgbox"Writing",48,"Title" but the quotes wont recognise. I've tried using {} but that doesn't help either?
Zatando
  • 5
  • 1
-3
votes
1 answer

How to get full info of the installed ram in vb.net

I am trying to find the following information about my installed ram using vb.net 2017
-3
votes
1 answer

How to add a none editable and dispalable original creator tag to a file

How to add a none editable and dispalable original creator tag to a file to prevent cheating in exams. I looking for a way, as it says, to stop cheating in exams. A way that the originators name, student/employee no or the like is added to the file…
-3
votes
4 answers

Visual Basic adding number loop

I am trying to make an idle game something like cookie clicker, and I am having problems with making a simple line of code that repeats every second and adds 5 to a number every second. Could anyone help me? I want this to start the loop if someone…
-4
votes
0 answers

I am Beginner in java. As this my first programming language. here in the code when i input values (5+2); i don't get any output why please explain

import java.util.*; // This is a package in through which take input in our calculator or any programme. public class SCalculator { public static void main(String[] args){ System.out.println("Lets Calculate"); System.out.println("Please…
-4
votes
1 answer

Copy value into rows between two blank rows

Please see image below. What I would like to do is copy the value in cell C3 into column B into rows 4-13. Then copy vehicle number in cell C16 into B17 and so on. Basically this displays all the trips a vehicle has made and the data for different…
-4
votes
2 answers

Convert From Basic to Javascript?

Good night, I need to translate this sample code from Basic into javascript. Javascript does not support the "Go To" instructions. I would be grateful if you could give me a translation. Many thanks 10 c = 1666.66 20 b = 1.007897747 30 a = 10000 40…
-4
votes
1 answer

BBC BASIC: Search for a string in a string

I have to write in BBC Basic at school (which I know nothing about) and have to write a program that searches for a string within a string.
Rob W
  • 11
-5
votes
2 answers

Celsius to Fahrenheit trs-80 basic

Does anyone remember the old old old BASIC code for converting Fahrenheit to Celsius? I'd really appreciate it if someone would post the text.
Red Cricket
  • 9,762
  • 21
  • 81
  • 166
-5
votes
1 answer

redefinition; different basic types

I've been doing a little coding with structures and i'm getting an consistent error that no one seems to can solve. I'm getting this error.Line 1 mostly. 1>c:\users\kevin\documents\visual studio 2010\projects\is the complier trying to piss me off\is…
kevin hay
  • 1
  • 1
  • 1
-27
votes
4 answers

How do you write a line of output?

I was assigned a program for class, and I have to make a line of output say "Hello World". I don't know how o do this, please help
1 2 3
56
57