Skip to content

Instantly share code, notes, and snippets.

@techsharif
Created January 21, 2019 08:23
Show Gist options
  • Save techsharif/0d8ef9b8212c0af050a3331dfb5f670d to your computer and use it in GitHub Desktop.
Save techsharif/0d8ef9b8212c0af050a3331dfb5f670d to your computer and use it in GitHub Desktop.
Basic BASIC

Your First Program

10 PRINT "Helloooooooooooooooo, world! I'm ready to "

Declare Variable

10 LET A = 5
20 PRINT A

String Basic

10 LET A = "Hello"
20 LET B$ = " World!"
30 PRINT A ; B$
40 PRINT A$ ; B
50 PRINT UPPERCASE(A)
60 PRINT LOWERCASE$(A$)
70 PRINT LEN$(B)
80 PRINT UPPERCASE(RIGHT(B,2))

Operator Basic

10 LET A = 5
20 LET B = 10
30 PRINT A+B
40 PRINT A-B
50 PRINT A*B
60 PRINT A/B
70 PRINT A%B

Condition

10 IF 2+2=4 THEN PRINT "Yes!"
20 IF 17<>10+7 THEN PRINT "Yes!" ELSE PRINT "No."
30 IF 1+1=2 THEN GOTO 50 ELSE GOTO 40
40 END
50 IF 1+1=2 THEN 60 ELSE 40
60 PRINT "Done."

Loop and Array

10 ARRAY A
20 DIM B(10)
30 DIM C(3,2)
40 LET A[4711] = 17
50 LET B(3) = 5
60 LET B[7] = 3
70 LET C(3,2) = 1
80 PRINT C(3,2) + B(7) + B[3] + A(4711)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment