Difference between revisions of "Apostrophe"

From QB64 Wiki
Jump to navigation Jump to search
imported>Clippy
m
(Reword and normalise with REM)
 
(4 intermediate revisions by 3 users not shown)
Line 1: Line 1:
The '''apostrophe''' is used to tell Qbasic to ignore a statement or programmer comment.
The '''apostrophe''' allows explanatory comments, or remarks, to be inserted in a program.  These may be included anywhere in the source code and extend to the end of the line.  Comments are ignored when the program is run.


{{PageSyntax}}
:: [[apostrophe|']] this is a comment
:: [[REM]] this is also a comment


''Usage:'' PRINT "Print this...." ' PRINT "Don't print this program comment!"


{{OutputStart}}
{{PageDescription}}
Print this....
* [[REM]] can also be used to insert comments but may only be used as the last, or only, statement on a line.
{{OutputEnd}}
* QBasic [[metacommand]]s like [[$INCLUDE]] must be included in a comment using either [[REM]] or [[apostrophe|']].
* [[Apostrophe]] comments, unavailable in earlier dialects of the BASIC language, are now generally favored over [[REM]] statements for their greater flexibility.
* Comments are also useful for disabling code for program testing and debugging purposes.




* Allows programmer comments or temporary code removal.
{{PageExamples}}
* [[REM]] can also be used to "comment out" a line.
{{CodeStart}}
* [[Metacommand]]s require that they are commented either with an apostrophe or [[REM]].
COLOR 11: PRINT "Print this...." ' PRINT "Don't print this program comment!"
* [[$INCLUDE]] requires a "comment" apostrophe before and after the included file name also.
{{CodeEnd}}


{{OutputStart}}
{{text|Print this....|aqua}}
{{OutputEnd}}


''See also:''


* [[Comma]], [[Semicolon]]
{{PageSeeAlso}}
* [[REM]]
* [[REM]]
* [[$DYNAMIC]], [[$STATIC]], [[$INCLUDE]]




{{PageNavigation}}
{{PageNavigation}}

Latest revision as of 11:35, 17 February 2021

The apostrophe allows explanatory comments, or remarks, to be inserted in a program. These may be included anywhere in the source code and extend to the end of the line. Comments are ignored when the program is run.

Syntax

' this is a comment
REM this is also a comment


Description

  • REM can also be used to insert comments but may only be used as the last, or only, statement on a line.
  • QBasic metacommands like $INCLUDE must be included in a comment using either REM or '.
  • Apostrophe comments, unavailable in earlier dialects of the BASIC language, are now generally favored over REM statements for their greater flexibility.
  • Comments are also useful for disabling code for program testing and debugging purposes.


Examples

COLOR 11: PRINT "Print this...." ' PRINT "Don't print this program comment!"

Print this....


See also



Navigation:
Keyword Reference - Alphabetical
Keyword Reference - By Usage
Main Wiki Page