forked from Mirror/wren
Write a bunch of docs.
This commit is contained in:
@ -64,11 +64,14 @@ Wren has a few prefix operators:
|
||||
They are just method calls on the operand without any other arguments. An
|
||||
expression like `!possible` just means "call the `!` method on `possible`".
|
||||
|
||||
These operators are infix (they have operands on either side):
|
||||
We have a few other operators to play with. The remaining ones are
|
||||
infix—they have operators on either side. In order of increasing
|
||||
precedence, they are:
|
||||
|
||||
:::wren
|
||||
== !=
|
||||
< > <= >=
|
||||
.. ...
|
||||
| &
|
||||
+ -
|
||||
* / %
|
||||
@ -78,6 +81,10 @@ left operand is the receiver, and the right operand gets passed to it. So
|
||||
`a + b` is semantically interpreted as "invoke the `+` method on `a`, passing
|
||||
it `b`".
|
||||
|
||||
Most of these are probably familiar already. The `..` and `...` operators are
|
||||
"range" operators. The number type implements those and returns a range object,
|
||||
which can in turn be iterated over using a [`for`](loops.html) loop.
|
||||
|
||||
## Subscript operators
|
||||
|
||||
Most languages use square brackets (`[]`) for working with collection-like
|
||||
|
||||
Reference in New Issue
Block a user