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
9
votes
3 answers

Multi-line functions in Commodore 64 BASIC

So, I'd like to write larger functions in Commodore 64 BASIC. So far, from what I'm seeing from other sources (such as various C64 wikis, as well as the user's manual for the C64 itself,) function definitions can only be one line long. That is to…
8
votes
4 answers

How can I exit Microsoft GW-BASIC, IBM BASICA, or other similar old dialects of BASIC?

Microsoft BASIC, GW-BASIC and BASICA all use a prompt that looks like this: I can't figure out how to exit any of these. Typing END does not exit them. EXIT, QUIT, Q, Ctrl+C, and everything else that I can think of also does not work. I'm sure…
MD XF
  • 7,860
  • 7
  • 40
  • 71
7
votes
3 answers

Help: ZX81 BASIC "Peek" function

I need a way to find if the character ('<') has hit a wall (Black pixel Graphic) -On a ZX81 game. I'm been looking at another game... which uses code if peek(peek 16398 +256*peek 16399) = code "**blackpixel graphic**" then ... Which seems to work…
ZX81
  • 71
  • 1
7
votes
2 answers

How to create TI-BASIC (TI-84+) input forms?

In the TI-BASIC programming language (Specifically TI-84+), how do you create input forms, such as the ones included in the default apps on the TI-84+. The image included here shows an example of what I'm trying to create: A menu that you can…
Psifrost
  • 107
  • 7
7
votes
9 answers

With Lua and Python embeddable, is there a place for Basic?

I started off programming in Basic on the ZX81, then BASICA, GW-BASIC, and QBasic. I moved on to C (Ah, Turbo C 3.1, I hardly knew ye...) When I got started in microcontrollers I regressed with the BASIC Stamp from Parallax. However, BASIC is/was…
Adam Davis
  • 91,931
  • 60
  • 264
  • 330
6
votes
1 answer

VBA Autofilter not equal to

Sub Macro1() ‘Remove all except validated ActiveSheet.Range("$A$1:$H$5202").AutoFilter field:=8, Criteria1:<>"Validated" Activesheet.Range("$A$2:$O$99999").SpecialCells(xlCellTypeVisible).Select Selection.EntireRow.Delete ActiveSheet.ShowAllData …
chee seng ng
  • 111
  • 1
  • 1
  • 10
6
votes
7 answers

How to Convince Programming Team to Let Go of Old Ways?

This is more of a business-oriented programming question that I can't seem to figure out how to resolve. I work with a team of programmers who have been working with BASIC for over 20 years. I was brought in to help write the same software in…
Austin
  • 834
  • 1
  • 10
  • 21
6
votes
1 answer

Print without newline

In BASIC I know of two instructions to print to the screen, PRINT, and WRITE, both of which automatically print strings with a newline at the end. I want to print a string without a newline. How can I do this? I'm using GW-BASIC.
MD XF
  • 7,860
  • 7
  • 40
  • 71
6
votes
2 answers

How do I view the source code of a GW-BASIC .BAS file?

I have an old .BAS file that I'm trying to view and for which I'm running into some problems. Searching online seems to indicate that I should be able to just open it in NOTEPAD.EXE or similar, but doing so gives me gibberish, like…
6
votes
2 answers

How to add a line in the middle of the program in TI-Basic Editor?

I am writing a simple Pong game in TI-Basic but the editor won't let me insert a line into the code I've already written. For example print "Hello world" <--Where I want to insert the code print "hello again" x = 5 If I try to insert code it simply…
user3674739
  • 57
  • 1
  • 2
  • 7
5
votes
1 answer

.net 5.0: can't use serial ports

I'm building an application for Windows, and I need to transfer data via serial port, but I can't figure out how to make it work. I tried different declarations, different imports, but nothing. Here are the 3 errors I get, from the 3 methods you can…
5
votes
1 answer

Modified C64 PRG BASIC header?

I recently bought a c64 mini and been trying to code some assembly using Turbo Macro Pro v1.2. While working on the hello world program I found a tutorial where an auto run BASIC header was used. I tried to also include a PRINT CHR$(147) to clear…
Dacobi
  • 417
  • 4
  • 14
5
votes
0 answers

Is there an argument that can be made the BASIC is a higher level language than Javascript?

I'm taking an introduction to IT course at WGU. According to the quiz results I got, Javascript is not a high level language while BASIC is a high level language. Not Visual Basic, not Quick Basic, classic BASIC is a higher level language than…
Jeffrey Harper
  • 748
  • 7
  • 7
5
votes
4 answers

Why do we use "End If" statement?

Why do we write END IF statement in this program? Without writing it, we can easily get our result. Is there any example through which you can explain me the use of END IF statement? I have tried this: INPUT X IF X>10 THEN PRINT "X IS GREATER THAN…
Bhavesh Sood
  • 51
  • 1
  • 1
  • 2
5
votes
0 answers

Can I tell the QB64 compiler *not* to optimize my code?

I want to experiment with the efficiency of various algorithms and compiler optimization is an obstacle. Can I disable compiler optimizations in QB64?
Alex V
  • 3,416
  • 2
  • 33
  • 52
1
2
3
56 57