en:variables [BASIC 256 - Language Documentation]

# BASIC 256 - Language Documentation

en:variables

## Variables

Variables that hold numeric values must begin with a letter, and may consist of any number of alpha-numeric characters. They are case sensitive. They may be used interchangeably with numeric constants.
Variables that hold string values follow the same rules as numeric variables, but must end with a dollar sign ($). They may be used interchangeably with string constants.
When you assign a numeric value to a string variable or add a numeric value to a string (concatenate) the number will be automatically converted to a string before the operation is completed. A string value may not be assigned directly to a numeric variable or array element without manually converting it's type using the Int or Float functions.

Variable Assignment
Operator | Name | Example | Comments
--- | --- | --- | ---
= | Assign a Number to a Numeric Variable | a = 9 |
= | Assign a String to a String Variable | z$ = “Hola.” |
= | Assign a Number to a String Variable | q$ = 9.9 |
+= | Add to Numeric Variable | a += 7 | Same as a = a + 7 1
+= | Concatenate to String Variable | f$ += ”.” | Same as f$ = f$ + ”.” 1
-= | Subtract from Numeric Variable | a -= 9 | Same as a = a - 9 1
*= | Multiply Numeric Variable | a *= 2 | Same as a = a * 2 1
/= | Divide Numeric Variable | a /= 8 | Same as a = a / 8 1

1 added with version 0.9.9.10

en/variables.txt · Last modified: 2012/11/01 09:10 by admin