Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
DAY 011: REM
#5
(11-16-2022, 04:43 PM)SMcNeill Wrote: Most people think that REM and ' (the single quote) are interchangeable and completely the same.  In fact, most people think that ' (the single quote) is nothing more than a shortcut to reduce typing out the whole word REM.

This isn't true!!

REM is a *COMMAND*.

' (the single quote) is part of a *COMMENT*.

With REM, REM is an actual command which basically says, "Hey, everything past this point is a comment!"

With ' (the single quote), ' is PART of the comment itself, and is basically excluded from your code.

A subtle difference, but one which can have drastic effects upon a program.  Let's take the following code for example:

Code: (Select All)
IF foo THEN REM foo is a make-believe variable for my example!

Code: (Select All)
IF foo THEN 'foo is a make-believe variable for my example!

Now, at first glance, those two statements look *exactly* alike.  They're not.  Tongue

The first code box contains a single-line IF statement, whereas the second code box contains the start of a multi-line IF statement.  You're going to have to put an END IF in the second code box, or else run into all sorts of errors in your code.

WHY??

Because you ended the first IF statement with a command.  Sure, it's a command which says, "A comment is coming next," but it's still a command.  Think of it just like you would:  IF foo THEN PRINT.   That command (REM, in this case) is enough to close up that IF statement and make it a valid single-line statement.
Your wisdom about the BASIC programming language seems to have no end, I'm surprised half the time or more that you get up to correct other people and help to clear misunderstandings. Previously I didn't care about "REM" except in MS-DOS batch scripts, LOL cannot use anything else in place of that keyword. Now this must be a reason why you proposed the "_NOREM" on Github!

I have to be reeled in so I put comments into my code to share with other people. Also I picked up the "double-apostrophe" from somewhere, it should have been three of them from a few Python code snippets with luxurious documentation.

Wait does this mean you guys will finally edit the QuickBASIC metacommands like $INCLUDE so we don't have to put an apostrophe at front any longer?
Reply


Messages In This Thread
DAY 011: REM - by SMcNeill - 11-16-2022, 04:43 PM
RE: DAY 011: REM - by bplus - 11-16-2022, 05:25 PM
RE: DAY 011: REM - by SMcNeill - 11-16-2022, 05:48 PM
RE: DAY 011: REM - by CharlieJV - 11-16-2022, 06:04 PM
RE: DAY 011: REM - by SMcNeill - 11-16-2022, 06:21 PM
RE: DAY 011: REM - by mnrvovrfc - 11-16-2022, 06:20 PM
RE: DAY 011: REM - by TerryRitchie - 11-16-2022, 07:06 PM
RE: DAY 011: REM - by SMcNeill - 11-16-2022, 07:29 PM
RE: DAY 011: REM - by TerryRitchie - 11-16-2022, 07:47 PM
RE: DAY 011: REM - by SMcNeill - 11-16-2022, 08:44 PM
RE: DAY 011: REM - by CharlieJV - 11-16-2022, 10:00 PM
RE: DAY 011: REM - by bplus - 11-16-2022, 08:27 PM
RE: DAY 011: REM - by Pete - 11-16-2022, 08:32 PM
RE: DAY 011: REM - by Jack - 11-16-2022, 08:37 PM
RE: DAY 011: REM - by Pete - 11-16-2022, 09:20 PM
RE: DAY 011: REM - by mnrvovrfc - 11-16-2022, 10:22 PM
RE: DAY 011: REM - by Dav - 11-16-2022, 10:03 PM
RE: DAY 011: REM - by CharlieJV - 11-16-2022, 10:13 PM
RE: DAY 011: REM - by Pete - 11-16-2022, 10:17 PM
RE: DAY 011: REM - by Pete - 11-16-2022, 11:04 PM
RE: DAY 011: REM - by SMcNeill - 11-16-2022, 11:13 PM
RE: DAY 011: REM - by Pete - 11-16-2022, 11:53 PM
RE: DAY 011: REM - by Dav - 11-17-2022, 12:45 AM
RE: DAY 011: REM - by CharlieJV - 11-17-2022, 01:01 AM
RE: DAY 011: REM - by mnrvovrfc - 11-17-2022, 01:20 AM
RE: DAY 011: REM - by SMcNeill - 11-17-2022, 12:59 AM
RE: DAY 011: REM - by Pete - 11-17-2022, 01:04 AM
RE: DAY 011: REM - by TerryRitchie - 11-17-2022, 02:02 AM
RE: DAY 011: REM - by Dav - 11-17-2022, 01:18 AM
RE: DAY 011: REM - by Pete - 11-17-2022, 01:23 AM
RE: DAY 011: REM - by Pete - 11-17-2022, 02:25 AM
RE: DAY 011: REM - by mnrvovrfc - 11-17-2022, 07:55 PM
RE: DAY 011: REM - by Pete - 11-17-2022, 08:26 PM
RE: DAY 011: REM - by bplus - 11-17-2022, 09:39 PM



Users browsing this thread: 7 Guest(s)