REM
REM comment
Code comments. Comments can also be introduced using #
,
single quote character '
.
The #
character can only be used as remarks if it is the
first character of the line.
Example 1:
' That text-line is just a few remarks
REM another comment
# one more comment
Example 2:
' Although the code is very short (less then thousands of lines...), it's
' almost impossible to decode it... - That's why comments are so useful:
' to remind *yourself* and others what you did and why.
' Let's try to analyze "Curlie borealis.bas" code and add few comments to it:
' --- Start of "Curlie borealis.bas" + Comments:
' Initialize variables for the main loop:
Randomize ' - I'm not sure why do we need it here... (MGA?)
440.03 ' Factor for defining x,y location to draw point
ff = 25000 ' Maximum points to draw in each shape
maxi = 2 ' Factor for defining two different color schemes in shape
maxi2 = maxi \ Rgb(40, 20, 30) ' Background color
b = Color 0, b
Cls
' Run program in an endless loop (Press Ctrl+B or Ctrl+C to stop):
While 1
9.444 ' Move the next shape to different x,y location
ff +=
' Draw a single shape using two color schemes, or draw an invisible shape:
For i = 0 To maxi
' Define location (x,y) to draw a single point:
f += ffMin(xmax, -x + Cos(f * i)) ' (MIN makes sure location is within screen)
x = Min(ymax, -y + Sin(f * i))
y =
' Define nice color to draw a point:
If cc Mod 6 = 0 Then
If i < maxi2 Then ' One color scheme
Rgb(255 - 255 * i \ maxi2, 255 * i \ maxi2, 0)
c = Else ' Second color scheme
Rgb(0, 255 - 255 * (i - maxi2) \ maxi2, 255 * (i - maxi2) \ maxi2)
c = Fi
Else
' Use background color to draw invisible shape
c = b Fi
' Draw a single point (pixel):
Pset x, y, c
If i Mod 5000 = 0 Then Showpage ' Update screen each 5000 points (smoother)
Next
' Counter for drawing invisible shape (using background color)
cc++ Wend
' --- End of "Curlie borealis.bas" + Comments
' To sum up:
' Whether you write a short program or long, comments will help you
' and others to understand, debug and improve your program later on; i.e.
' comments make your code useful!
REM "Curlie borealis.bas" code example taken from:
REM http://smallbasic.sourceforge.net/?q=comment/1184#comment-1184
REM Without explicit permission from MGA...
Code samples using REM
000 hello.bas
001 3 ways to print hello 5 times.bas
002 numeric variables.bas
004 loops.bas
005 challenge.bas
006 arrays+.bas
100lines.bas
2048.bas
2048.bas
3d_palmx.bas
7gables.bas
ai.bas
analog clock.bas
anomail.bas
bairstow.bas
BAS_1968.bas
BAS_NOW.bas
base64.bas
betrayal: crows ii.bas
biorythms.bas
blackjack.bas
BlackJack.bas
blushing snowflakes.bas
Calendar.bas
calendar.bas
Capitol pal test.bas
Chaos_1xt.bas
Chaos_NPhase.bas
circ.bas
Language
AND
AS
BAND
BG
BOR
BYREF
CALL
CASE
CATCH
CONST
DECLARE
DEF
DO
ELIF
ELSE
ELSEIF
END
END TRY
ENDIF
EQV
EXIT
FALSE
FI
FOR
FUNC
GOSUB
GOTO
IF
IFF
IMP
IN
LABEL
LET
LIKE
LOCAL
LSHIFT
MDL
MOD
NAND
NEXT
NOR
NOT
ON
OR
REM
REPEAT
RETURN
RSHIFT
SELECT
STEP
STOP
SUB
THEN
THROW
TO
TRUE
TRY
UNTIL
USE
USG
USING
WEND
WHILE
XNOR
XOR
If there is insufficient information on this page and you wish learn more about REM,
please send an email to smallbasic@gmail.com. You can help to improve information about
REM by submitting a pull request,
click View Source for details. Note, an offline language reference text file is also available - see the Download section.