This is an old revision of the document!
Expressions by themselves aren't particularly powerful. Functions like previous(), either() and visited() can help in making links, <<print>> and <<if>> macros more interesting, but if you want anything more complex than those, variables will be necessary.
A variable is a place to store a value so that you can remember it later. You can store both strings and numbers in variables. The variable
$name might contain the main character's name, “Agatha Christie”, or the variable
$money might contain the amount of money Agatha has in her pocket – the number 15.75.
Variables have a few restrictions on their names. They must start with a $ sign. That's called a sigil — it tells the computer that what's coming next is a variable, not a number or string.
After the initial $ sign, a variable name can begin with a letter, either uppercase or lowercase, or an underscore _. After the first letter, you can have any combination of letters, numbers, or underscores. Punctuation and spaces aren't allowed anywhere.
Here are some legitimate variable names:
$housesDestroyed $_my_favorite_color $AN_EXTREMELY_IMPORTANT_NUMBER $street8 $i
Some bad variable names:
$what was it called $Idon'tRemember $3.95 $8thSurprise $$$make_money_fast$$$