Multiline shebang: Difference between revisions

julia example
m (→‎{{header|Perl 6}}: Update to modern calling convention)
(julia example)
Line 328:
 
Note that we've left off the onfail handler within J, and just used a minimal definition to give us a non-zero exit code for the error case. Mostly, the assumption here would be that the error message would not be interesting, and that any failure should be handled by a retry. But you could replace the exit on error line here with the full definition and <code>9!:</code> preparatory bit from the previous example and you could also of course change the <code>1!:2&2</code> lines (<code>1!:2&2</code> is the "low-level" write to stdout mechanism for J - and, yes, those numbers are part of the definition of the language - or at least the "Foreigns" part of the language - note that ultimately all computer languages resolve to things which can be thought of as numbers or sequences of numbers, though some people will vigorously assert other things).
 
=={{header|Julia}}==
<lang julia>
#!/bin/sh
#=
echo Julia will ignore as commented all text between #= and =#
echo which allows us to place arbitrary unix shell code here
echo perhaps to change environment settings for Julia or
echo set the directory prior to starting the Julia program.
echo for example:
cd /user/meeting/working
echo then start the Julia program
exec julia "$0" "$@"
# comments ignored by Julia end here --> =#
 
function countto(n)
i = zero(n)
println("Counting to $n...")
while i < n
i += 1
end
println("Done!")
end
 
@time countto(10^10)
</lang>
 
 
=={{header|MATLAB}}==
4,102

edits