950 B
950 B
Expressions
Expressions are the basis of programming in Ava. An expression is some code that will produce a value when evaluated.
Syntax
Most non-Definition code is considered an expression. Expressions include:
- Literals
- Variables
- Function Calls
- Control Expressions
In general, using a Literal or a Variable for an expression wraps that value in
a pure
function that returns the value when evaluated.
Control Expressions
If Then
The if/then
expression expects an expression that returns a Boolean Value.
That expression is evaluated. If it evaluates to true
, the then
expression
is evaluated. Otherwise the else
expression is evaluated.
if <boolean expr> then <expr> else <expr>
Do Yield
TODO: This is incomplete
The do/yield
expression allows for imperative composition of monadic
expressions.
do
x <- foo()
y <- bar()
_ <- baz()
yield
x + y