May 2018
Beginner
252 pages
6h 19m
English
The operations on numbers (+, -, *, /) can take two forms:
You can calculate the remainder of a division with % or // (remainder or modulo). Common logarithmic and trigonometric functions are available, together with functions to calculate the maximum and minimum of two numbers (max and min). Logical functions such as even?, positive?, or zero? test common conditions in calculations, and a versatile round function is available:
round 2.35 ;== 2.0round 2.5 ;== 3.0round/to pi 0.001 ;== 3.142 ; rounds to 0.001
Here we see a first example, /to, of a so-called refinement. It is a kind of flag that is appended to ...