Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
DAY 011: REM
#1
A command which everyone thinks they know flawlessly, and yet, they probably don't.  Tongue

What is it?  REM is a command that allows people to place remarks inside a program so that it helps clarify what's going on and makes it much easier to come back to the program at a future time and understand just what the BLEEP the programmer was thinking when he coded everything originially.

How to use it?  Just add REM to where you want to place a comment, and then type out your comment!



And with the basic description of this most basic command out of the way, let's touch back upon the opening sentence which begins this post, where I claimed: most folks don't know everything about REM, like they think they do.  WTH is up with that??  "What are people misunderstanding", you ask?

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.

On the other hand, the second segment of code is basically just IF foo THEN....  Then WHAT??  You're not telling that IF statement what to do on that line, so it's got to be a multi-line IF statement.

REM is a *COMMAND*, just like GOTO, PRINT, and all the other commands in the language.  It's just a command which says, "Comments to the right!"

' (the single quote) is an actual part of a comment, and is basically ignored when used as one inside your programs.  It's not a command, and that's the biggest difference -- and it's a significant one -- between the two.
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: 4 Guest(s)