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(5 bytes, as opposed to 2).
=== 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 To assign a 16-bit Integers === These are defined by giving value to a signed integer directly, you should give 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 ===
== Type Conversions ==
To <code>ROUND</code>, <code>INT</code> and <code>FIX</code> can be used to convert real numbers into integers taking some care about rounding. The difference is in rounding mode - <code>ROUND</code> rounds to nearest, <code>FIX</code> rounds to zero, whereas <code>INT</code> always rounds down. e.g., <code>value%=INT(3.14)</code>. Note that if you don't specify the % you will actually get a real number still. To convert an integer from to a real or another number, you can use the <code>UNT</code> keyword. e.g., <code>real=UNT(&ABCD)</code>. <pre>w=UNT(50000)ReadyPRINT w-15536Ready</pre> If you want an integerresult from division, use the <code>\</code> integer division operator. e.g., <code>int=value\divisor</code>. This is as opposed to the standard <code>/</code> division operator, that can create a real number.
== Command list ==