Discussion

Rem's - only on a new, empty line ?

2

Dan 2021-03-28 09:33 (Edited)

Hi, are the remarks allowed only on a new line ?

I'm kinda used to put them (sometime) on the same line, just like this:

IF A=3 AND B=0 then         'LEFT WAS NOT CHECKED
        If SX>0 Then 
                Print "2"
        END IF
End IF

IF A=3 AND B=0 then
'LEFT WAS NOT CHECKED
    If SX>0 Then 
                Print "1"
    END IF
End If

But the LowresNX displays an error "expected command" in the first example and points it to the "if SX>0 Then" line.

It would be nice if remarks could be added on the same line, or at least, state this in the User manual.


was8bit 2021-03-28 10:57 (Edited)

It does not spell out where you cannot use them, but it does spell out their purpose, which is to cause line to not execute...

REM

REM remark
' remark
Allows you to put comments into your program. REM lines are not executed. You can use an apostrophe (') in place of the word REM.

REM THIS IS A TEST PROGRAM
REM WRITTEN BY TIMO KLOSS
PRINT "HELLO"
'SHOW MORE TEXT...
PRINT "BYE"

And as multiple execution lines are NOT allowed to be stacked in one line (as they are allowed in some languages) the only logical place to use them so that a line won't execute is at beginning of a line

... but i agree that an example of how NOT to use them would remove that possible thought...


was8bit 2021-03-28 11:04 (Edited)

I use REM to remove (REMove) a line of command, so as to either test what happenes, or if i am experimenting with differrent code, or if i am temporarily testing stuff..

I use ' as more like official stuff, or also to make the code look nicer or more readable...

'
' INITIALZE
'
... code...


Timo 2021-03-28 11:06

I think the only way in classic BASIC was to write it with a colon, so it works like a normal command.

PRINT "HELLO" : REM GREET

I decided against the possibility to write several commands in one line to keep lines shorter, having the iPhone app in mind.


was8bit 2021-03-28 11:11

You "CAN" imbed REM.. for examle, this is allowed...

X=0
IF X=2 THEN PRINT "HI" ELSE REM HI

Will execute without error, and this will run as well...

X=0
IF X=2 THEN PRINT "HI" ELSE ' HI


Dan 2021-03-28 15:05

I guess i'll have to remember this for the LowresNX


was8bit 2021-03-28 15:49

I remember old school basic, with line numbers starting each line ;)


Log in to reply.