New command
expr
Short for expression. It works out the words that you type after it and writes the result. Give it two numbers with a sign between them, and the result is the answer.
Usageexpr number sign number
Examples
expr 10 - 3
7
expr 4 \* 5
20
To multiply, type
\*, with the backslash. On this computer, * alone has another job (Chapter 5 explains it), and the backslash makes sure the * gets to expr unchanged.Objectives
- What is 12 times 12?
- What is 250 plus 175? The card does not show the sign for plus. Make a guess.
- Think before you type: what does
expr 19+23write?