Changes

Jump to: navigation, search

Locomotive BASIC

122 bytes added, 16:45, 25 November 2013
=== Real (Floating Point) Numbers ===
This is the default type for a Locomotive BASIC variables, but can be clarified using <code>!</code> after the variable name, e.g., <code>real!=500.0</code>.You can force all variables starting with specific letters to be this type by using the <code>DEFREAL</code> keyword.
In many cases you don't want to use these, as they are slower than using the integer type, and use more memory.
=== Signed 16-bit Integers ===
Defined using <code>%</code> after the variable name, e.g., <code>integer% = 500</code>.You can force all variables starting with specific letters to be this type by using the <code>DEFINT</code> keyword.
These can store values between -32,768 and 32,767.
=== Unsigned 16-bit Integers ===
These are defined by giving the number in a hexadecimal format, e.g., <code>uint=&c0000</code>.You can store values between 0 and 65,535 (&FFFF). To convert a number into this format, you will need to use the convoluted <code>uint=VAL("&"+HEX$(value))</code>.
=== Strings ===
These are defined by using <code>$</code> after the variable name, e.g., <code>str$="Hello"</code>.You can force all variables starting with specific letters to be this type by using the <code>DEFSTR</code> keyword.
A String can be up to 255 characters long.
17
edits