Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
30
Task/Variables/Commodore-BASIC/variables-3.basic
Normal file
30
Task/Variables/Commodore-BASIC/variables-3.basic
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
REM Tiny Basic has exactly 26 variables.
|
||||
REM They start off initialised to zero.
|
||||
PRINT A
|
||||
|
||||
REM The only data type is sixteen-bit signed integer.
|
||||
REM They are assigned using the LET statement.
|
||||
REM Their scope is the whole program.
|
||||
LET B = -12345
|
||||
REM The integer arithmetic operations of + - * and / can be used
|
||||
REM and so can the unary negative and positive operators - +
|
||||
LET C = 1 + B - B/5
|
||||
LET A = -B
|
||||
PRINT "B is ", B
|
||||
PRINT "C is ", C
|
||||
GOSUB 10
|
||||
|
||||
REM The comparison operators = < > <= >= <> are available,
|
||||
REM but their results are not expressions and can only be used in an
|
||||
REM if statement.
|
||||
LET D = 3
|
||||
IF D <> 7 THEN LET D = 7
|
||||
GOTO D-2
|
||||
PRINT "Skip this"
|
||||
5 PRINT "Gotos and gosubs can be computed. Beware of moving spaghetti."
|
||||
END
|
||||
10 PRINT "B is now ", B
|
||||
RETURN
|
||||
|
||||
REM Tiny Basic does not support arrays or pointers. Strings can
|
||||
REM be used, but only as string constants within a PRINT statement.
|
||||
Loading…
Add table
Add a link
Reference in a new issue