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
5
votes
2 answers

Generating random direction in C64 Basic

I have run the ‘More Bouncing Balls’ Basic program from chapter 5 of the C64 user’s manual, with the addition from the final page of the chapter. The code is as follows: 10 PRINT CHR$(147):REM SHIFT CLR/HOME 20 POKE 53280,7 : POKE 53281,13 30…
Canned Man
  • 734
  • 1
  • 7
  • 26
5
votes
4 answers

Is there any freeware QBASIC compatible IDE for BASIC?

What freeware IDE is available other than Visual Basic? Is there any freeware QBASIC compatible IDE for BASIC?
user366312
  • 16,949
  • 65
  • 235
  • 452
5
votes
1 answer

Invoking mysqldump from script without password prompt

I need to execute a cmd command in Visual Basic. It's not difficult but i need to give a argument while the external Programm runs. F:\mysql-5.7.13-winx64\bin\mysqldump.exe -h -u -p > abcd.sql But after that is executed, the…
Dominic Järmann
  • 361
  • 1
  • 7
  • 18
5
votes
2 answers

How do I refactor out GOTO statements in GWBASIC code?

I'm currently refactoring a heap of old GWBASIC code into python so it can be run on newer machines. They're all old engineering mathematics programs which are quite maths heavy as well as using the GOTO statement massively throughout. I'm just…
aw4lly
  • 2,077
  • 1
  • 12
  • 13
5
votes
1 answer

Strange BASIC math formula

I like converting old BASIC games - I ran across one that had this odd formula. Currently I am writing in Pascal, but I can write it in any language. After rummaging through the code, I could not find if this var in use, but still would like to know…
Klyxmaster
  • 53
  • 2
4
votes
0 answers

What is a "base" program on a Casio calculator?

When I make a program, I have the option to make it either "run" or "base". https://src.mrhitech.repl.co/calcmanual.pdf (backup; the original one seems to have been taken down) mentions a "base" program several times on pages 213-214, but never says…
MrHiTech
  • 99
  • 1
  • 5
4
votes
1 answer

Can I take the entire console and save it as a string variable?

I'm trying to take the entire console text at the end of the program and save it as a string variable. Then after I will take the string variable and save it as a text document. What would be the best way to tackle this obstacle? Thank you!
4
votes
3 answers

Casio - Basic programming

It's a bit urgent... ;) Someone i know have a Casio calculator (FX-9750 / Grahp35+). There is in the menu a functionnality TVM with "Days Calculation" that permits to know the number of days between 2 dates. I have to program for this calculator…
Sebastien Lorber
  • 89,644
  • 67
  • 288
  • 419
4
votes
3 answers

Is it possible to store any PETSCII character in a DATA statement string in Commodore BASIC?

I would like to store some binary data in a BASIC program on the Commodore 64 as DATA statements. To save space, I'd prefer to store as a string, rather than as a sequence of numbers. Is it possible to store any character, from CHR$(0) through…
Laurence Gonsalves
  • 137,896
  • 35
  • 246
  • 299
4
votes
1 answer

How Could One Write This Basic PAINT Statement in JavaScript?

In BASIC there is a command called PAINT that looks like this: PAINT (column, row), color, color-stop It takes x/y coordinates as a starting place and begins filling it and the surrounding pixels in with color until it reaches the color defined in…
Dave Mackey
  • 4,306
  • 21
  • 78
  • 136
4
votes
9 answers

Are Fortran, Cobol, Basic and Forth high level programming languages?

Are Fortran, Cobol, Basic and Forth high level programming languages? And if not, what where the first high level programming languages? Which were the first object-oriented languages?
Aaron de Windt
  • 16,794
  • 13
  • 47
  • 62
4
votes
6 answers

What kind of BASIC is this?

I fully expect downvotes, but this got me really curious, and I hope at least someone can answer. Our discrete mathematics professor really likes old languages for the plethora of bitwise operators they provide. Now, he gave us a homework which was…
user3079266
4
votes
1 answer

Syntax error message with GW-BASIC

I am currently stymied by the following error message from GW-BASIC: Syntax error in 450 Ok 450 STEP=0 Here is the context: 400 ON KEY(13) GOSUB 590 ' right arrow key makes direction clockwise 410 ON KEY(12) GOSUB 610 ' left arrow key makes…
user46019
  • 41
  • 1
4
votes
3 answers

Visual Basic Windows Form - Running Python script w/ button

I have a simple visual basic window (or 'form'), and at the click of a button on the form, I want my Python script to run. How would I go about this?
just_a_programmer
  • 341
  • 1
  • 3
  • 9
4
votes
3 answers

Do not match if a char is between quotation marks(AKA has a programming string pattern)

I have been assigned to write a compiler for Basic programming language. In basic, codes are separated with new lines or by : mark. e.g to following to codes are valid. Model# 1 10 PRINT "Hello World 1" : PRINT "Hello World 2" Model# 2 10 PRINT…
dariush
  • 3,191
  • 3
  • 24
  • 43
1 2
3
56 57