23 lines
910 B
Text
23 lines
910 B
Text
'This is a comment line. It also could have been preceded with "Rem"
|
|
|
|
Dim i% 'This line is not necessary, but % strict casts
|
|
'as an Int (2 bytes). "As Int" could have been used instead.
|
|
Input "#? ", i% 'Prints "#? " as a prompt and waits
|
|
'for user input terminated by pressing [ENTER].
|
|
|
|
'Binary integers example
|
|
If i% And 1 Then 'Test whether the input value AND 1 is 0 (false) or 1 (true).
|
|
'There is no global or constant "True" or "False".
|
|
Print "Odd" 'Prints "Odd" if the above tested "true".
|
|
Else 'This could have been also been "ElseIf Not (i% And 1)"
|
|
Print "Even" 'Prints "Even in all other cases (Else)
|
|
'or if the logical inverse of the input value AND 1 tested
|
|
'"true" (ElseIf).
|
|
End If
|
|
|
|
'Modular congruence example
|
|
If i% Mod 2 Then
|
|
Print "Still Odd"
|
|
Else
|
|
Print "Still Even"
|
|
End If
|