Fork: Difference between revisions

Content added Content deleted
(Added Delphi example)
(Updated to make the program able to compile and execute. Added output.)
Line 1,020: Line 1,020:
=={{header|Nim}}==
=={{header|Nim}}==
<lang nim>import posix
<lang nim>import posix

var pid = fork()
var pid = fork()
if pid < 0:
if pid < 0:
# error forking a child
echo "Error forking a child"
elif pid > 0:
elif pid > 0:
# parent, and pid is process id of child
echo "This is the parent process and its child has id ", pid, '.'
# Further parent stuff.
else:
else:
# child
echo "This is the child process."
# Further child stuff.</lang>
quit()

# further Parent stuff here</lang>
{{out}}
<pre>This is the parent process and its child has id 8506.
This is the child process.</pre>


=={{header|OCaml}}==
=={{header|OCaml}}==