These examples show how algebraic expressions work in wasora, which is basically as they should. The basic operators are composed by the four basic operations
/ plus the exponentation operator
^. Parenthesis also work as expected, and can be nested up to any level. Other operators such as comparisons and logicals are introduced in other examples.
Expressions works as expected. If you find one case where they do not, please report it to the author of wasora.
# algebraic expressions do whatever one expects them to do # thus a should evaluate to 7 a = 1 + 2*3 # and b should evaluate to 9 b = (1+2) * 3 # expressions can contain variables and functions, whose # arguments may be expressions themselves, and so on c = (1 + sin(pi/4)^(5/2))/(1 - log(abs(a-b))) PRINT %g a b c # when an expression appears as an argument of a keyword and # contains spaces it should be written within double quotes PRINT %g 1 -1 "1 -1"
TEXT keyword, as the following example illustrates.
Note that the double quotes are not needed, as there are no spaces in
1+2*sin(0.7). However, it is a good practice to leave them for text strings, as one might want to add extra spaces in the future.