Code Basics

 

Combining Statements on One Line

 

Unlike languages such as C, Basic has no command terminator.  However you can place two or more statements on the same line using a colon (:)  to separate them:

x=14: y=2: a=-12.055

 

Adding Comments

Standard Basic REM comments are supported, as well as the apostrophe (') symbol.  Both tell the compiler to ignore the rest of the line.

' Here is a comment on a line by itself
delaymS(15)  ' 15ms Delay   (comment can follow statements as well)

 

Numbering Systems

Both decimal and hexadecimal numbering systems are supported.  As well as single character values.

Decimal

Hexadecimal

Binary

8

&H8 or 0x8

0b1000

10

&HA or 0xA

0b1010

240

&HF0 or 0xF0

0b11110000 or 0b1111.0000

* A period  has no effect in binary values

 

Literal Representation

Values are represented in three different ways.

  1. Decimal Hexadecimal, or Binary values are simply entered in directly.
  2. Characters are single characters enclosed in quotes (") IE:  "A"or "3"
  3. Strings are more than one character enclosed in quotes ( stored in small tables in program memory).  IE:  "This is a string"