ela

Tutorial, lesson 2 of 9

Variables and strings

A variable is set with = and read with $. Reading one that nothing has set is an error at its line, never an empty string, so a typo such as $nmae stops the script where it is.

Inside double quotes, $name puts the variable’s text in place. ${ } holds an expression: a call such as len($name), a sum, an item of a list.

Text and numbers never mix. Add the line echo ${$count + "1"} and run it: the error names the column, and the rule below it says to convert with int().

What it prints
Hello from ela
ela has 3 letters
ELA in capitals
3 lessons, 1 done