Warning

You're browsing the old v2.x documentation. This version is no longer maintained. Click here to go the v3.x documentation.

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
syntax [2019/07/15 20:55] neilssyntax [2019/12/09 08:40] (current) – [Comments] neils
Line 1: Line 1:
 ====== Syntax ====== ====== Syntax ======
  
-An **XC=BASIC** program is built from one or more plain ASCII text files that consist of lines, allowing only one statement per line.+An **XC=BASIC** program is built from one or more plain ASCII text files that consist of lines, allowing one or more statements per line.
  
-Each line may contain a statement, a label or both.+Each line may optionally contain a label and zero or more statements separated by a colon ('':''):
  
   label1: print "hello world"   label1: print "hello world"
   label2:   label2:
   print "hello again"   print "hello again"
 +  let x = 5 : print x : rem "these were more statements in a line"
 ===== Whitespace ===== ===== Whitespace =====
  
Line 68: Line 68:
 ===== Comments  ===== ===== Comments  =====
  
-The only way to add comments is the [[REM|REM]] statement.+The only way to add comments is the [[REM|REM]] statement. The ''REM'' keyword however has two aliases: the semicolon ('';'') and the single quote ('''''). 
 + 
 +    rem This is a comment 
 +    ' This is also a comment 
 +    ; This is also a comment
  
 ===== String literals ===== ===== String literals =====
Line 85: Line 89:
   print "{5}white text"   print "{5}white text"
      
 +Make sure to check the list of all [[petscii_escape_sequences|]].
 ===== Character literals ===== ===== Character literals =====
  
-character enclosed in single quotes (''''') evaluates to its PETSCII code.  Escape sequences are supported in character literals as well.+Since version 1.2, a character enclosed in single quotes (''''') evaluates to its PETSCII code.  Escape sequences are supported in character literals as well.
  
 Example: Example: