Line numbers: Difference between revisions

From QB64 Phoenix Edition Wiki
Jump to navigation Jump to search
(Created page with "'''Line numbers''' or '''line labels''' are used to denote GOTO, RUN or GOSUB procedure lines or all code lines as in GW Basic. == Number Syntax == :: '''10''' GOTO {line number| line label} == Label Syntax == ::'''PictureData:''' :: DATA 0, 0, 12, 12, 14, 12, 12, 0, 0 * Line numbers are used to denote a specific line of code. No colon required. * Line labels are used to denote a specific line of code with a colon when separating it from a co...")
 
No edit summary
 
(6 intermediate revisions by the same user not shown)
Line 4: Line 4:
== Number Syntax ==
== Number Syntax ==
:: '''10''' [[GOTO]] {line number| line label}
:: '''10''' [[GOTO]] {line number| line label}


== Label Syntax ==
== Label Syntax ==
Line 12: Line 13:
* Line numbers are used to denote a specific line of code. No colon required.
* Line numbers are used to denote a specific line of code. No colon required.
* Line labels are used to denote a specific line of code with a [[colon]] when separating it from a code line.
* Line labels are used to denote a specific line of code with a [[colon]] when separating it from a code line.
* [[GOSUB]] or [[DATA]] block line labels can be numerical or text line names. [[RESTORE]] can use the label to reuse data.  
* [[GOSUB]] or [[DATA]] block line labels can be numerical or text line names. [[RESTORE]] can use the label to reuse data.
* [[GOSUB]] blocks require a [[RETURN]] to return to the original call or to a line label or number to return to.
* [[GOSUB]] blocks require a [[RETURN]] to return to the original call or to a line label or number to return to.
* [[ON ERROR]] [[GOTO]] line label or number calls use [[RESUME]] [[NEXT]] or a line label or number to resume to.
* [[ON ERROR]] [[GOTO]] line label or number calls use [[RESUME]] [[NEXT]] or a line label or number to resume to.
Line 20: Line 21:




''See also:''
{{PageSeeAlso}}
* [[GOTO]], [[RUN]]  
* [[GOTO]], [[RUN]]
* [[GOSUB]], [[RETURN]]
* [[GOSUB]], [[RETURN]]
* [[DATA]], [[RESTORE]]
* [[DATA]], [[RESTORE]]
* [[ON ERROR]], [[RESUME]], [[NEXT]]
* [[ON ERROR]], [[RESUME]], [[NEXT]]
* [[Line_number|Line number removal procedures]]
* [[Line number|Line number removal procedures]]




{{PageNavigation}}
{{PageReferences}}

Latest revision as of 13:22, 19 November 2024

Line numbers or line labels are used to denote GOTO, RUN or GOSUB procedure lines or all code lines as in GW Basic.


Number Syntax

10 GOTO {line number| line label}


Label Syntax

PictureData:
DATA 0, 0, 12, 12, 14, 12, 12, 0, 0


  • Line numbers are used to denote a specific line of code. No colon required.
  • Line labels are used to denote a specific line of code with a colon when separating it from a code line.
  • GOSUB or DATA block line labels can be numerical or text line names. RESTORE can use the label to reuse data.
  • GOSUB blocks require a RETURN to return to the original call or to a line label or number to return to.
  • ON ERROR GOTO line label or number calls use RESUME NEXT or a line label or number to resume to.
  • GOTO or RUN can refer to a specific numerical line number or text line label.
  • Line numbers are no longer required in QB or QB64 except for GOSUB, RUN or GOTO situations.
  • Line numbers and labels are not allowed after SUB/FUNCTION blocks. They are allowed inside SUB/FUNCTIONS though.


See also


QB64 Programming References

Wiki Pages
Main Page with Articles and Tutorials
QB64 specific keywords (alphabetical)
Original QBasic keywords (alphabetical)
QB64 OpenGL keywords (alphabetical)
Keywords by Usage
Got a question about something?
Frequently Asked Questions about QB64
QB64 Phoenix Edition Community Forum
Links to other QBasic Sites:
Pete's QBasic Forum
Pete's QBasic Downloads