Nim (programming language): Difference between revisions

Content deleted Content added
Reversing a string: not too exotic
m Reversing a string: bypass redirect
Line 55:
echo "Reversed: ", reverse(str1)
</syntaxhighlight>
This example shows many of Nim's features, one of the most exotic ones is the implicit <code>result</code> variable: every procedure in Nim with a non-void return type has an implicit result variable that represents the value that will be returned. In the for loop we see an invocation of <code>countdown</code> which is an iterator, if an iterator is omitted then the compiler will attempt to use an <code>items</code> iterator if one is defined for the type that was specified in the for loop. A related <code>result</code> variable exists in [[REXXRexx]].
 
=== Metaprogramming ===