Sleep: Difference between revisions

515 bytes added ,  1 year ago
no edit summary
No edit summary
Line 1,155:
 
The time can be a decimal like 1.5 though the actual resolution of <code>sleep-for</code> depends on the operating system. The similar <code>sit-for</code> stops sleeping if there's pending keyboard input.
 
=={{header|EMal}}==
<syntaxhighlight lang="emal">
^|The pause command takes milliseconds, we adjust to seconds|^
fun main = int by List args
int seconds
if args.length == 1 do seconds = int!args[0] end
if seconds == 0
seconds = ask(int, "Enter number of seconds to sleep: ")
end
writeLine("Sleeping...")
pause(1000 * seconds)
writeLine("Awake!")
return 0
end
exit main(Runtime.args)
</syntaxhighlight>
{{out}}
Sample session:
<pre>
Enter number of seconds to sleep: 7
Sleeping...
Awake!
</pre>
 
=={{header|Erlang}}==
226

edits