Start from a main routine: Difference between revisions

Line 217:
 
=={{header|Nim}}==
In the usual case,Nim anythingdoes not inrequire a procedure iscalled "main." However,for youprogram canexecution, usebut theprogrammers variableare isMainModulefree to create a main-likeprocedure startingwith pointthat for code execution in Nimname.
<pre>
proc main() =
echo "Hello World!"
 
main()
<pre>
proc boogie*(moves: int) =
for i in 1..moves:
echo $i
when isMainModule:
boogie(5)
</pre>
 
In this example, the procedure call boogie(5) will only execute if the module containing it is compiled and run directly. If the module is merely imported by another module, the code will not execute.
 
=={{header|Oforth}}==
Anonymous user