Start from a main routine: Difference between revisions

(omit swift)
Line 129:
 
=={{header|Mathematica}}==
Mathematica automatically starts a REPL (read-eval-print loop), which is a kind of event loop. If that is not desired, pass -run on the command line. Note that if Mathematica is called via MathLink from within an external program, then the main loop has to be defined, which will usually differ from the standard one.
 
=={{header|Oforth}}==
 
If Oforth loads a file and this file does not launch anything, nothing happens but file interpretation, and oforth leaves.
 
For instance if file1.of is :
<lang Oforth>func: mysleep(n)
{
"Sleeping..." println
System sleep(n)
"Awake and leaving." println
}</lang>
 
{{out}}
<pre>
>oforth file1.of
</pre>
Nothing happens because oforth has nothing to perform.
 
If Oforth loads a file and this file launchs a function or method, it will be interpretred (and so, performed), and oforth leaves.
 
With this file (for instance file2.of) :
<lang Oforth>func: mysleep(n)
{
"Sleeping..." println
System sleep(n)
"Awake and leaving." println
}
 
mysleep(10000)</lang>
 
{{out}}
<pre>
>oforth file2.of
Sleeping...
Awake and leaving.
</pre>
The function is performed.
 
Another way is to load a file and give what to run into the command line. For instance, using file1.of
{{out}}
<pre>
>oforth --P"mysleep(10000)" file1.of
Sleeping...
Awake and leaving.
</pre>
 
=={{header|PARI/GP}}==
1,015

edits