Content deleted Content added
fixed some grammar |
Zhihua.lai (talk | contribs) No edit summary |
||
Line 121:
</pre>
===Iteration===
In Magik the <code>_while</code>, <code>_for</code>, <code>_over</code>, <code>_loop</code> and <code>_endloop</code> statements allow iteration.
<pre>
_block
_local s << 0
_local i << 0
_while i <= 100
_loop
s +<< i
i +<< 1
_endloop
>> s
_endblock
</pre>
Here, the _while is combined with _loop and _endloop.
<pre>
_method my_object.my_method(_gather values)
Line 159 ⟶ 175:
x << my_procedure(1, 2, 3) # x = 6
</pre>
===Regular Expression===
Magik supports // regular expression syntax:
<pre>
_if /Hello\,\s(\w)+!/.matches?("Hello, Magik!") _then
write("Got a match!")
_endif
</pre>
===Language Quirks===
Because Magik was originally developed in England, methods in the core smallworld libraries are spelled using [[British English]]. For example:
|