Standard Library · expr
class Un
A unary operation: !e or -e.
since 0.1.0-alpha.1linuxwindowswasm
- bases
Node
Examples
expr::Node tree = expr::Un("-", expr::Field(["balance"]));
match (tree) {
expr::Un => { expr::Un u = tree; console.writeln("unary ${u.op}"); }
else => { console.writeln("not a Un"); }
}
unary -
Constructors
new
new(string o, Node inner)Create a unary-operation node.
Parameters
- o
- The operator text,
"!"or"-". - inner
- The operand.
Examples
expr::Un u = expr::Un("!", expr::Field(["active"]));
console.writeln(u.op);
match (u.e) {
expr::Field => { console.writeln("operand is a field"); }
else => { console.writeln("operand is something else"); }
}
!
operand is a field
Fields
e
Node eThe operand.
op
string opThe operator text, "!" or "-".
See also
- Bin — A binary operation:
l op r.