Modulinos: Difference between revisions
m
→{{header|Wren}}: Minor tidy
No edit summary |
m (→{{header|Wren}}: Minor tidy) |
||
(5 intermediate revisions by one other user not shown) | |||
Line 427:
{{trans|Wren}}
<syntaxhighlight lang="emal">
^|We have created a module named ModulinosPart.emal.
|^
in Org:RosettaCode
type
fun meaningOfLife = int by block do return 42 end
fun main = void by block do writeLine("The meaning of life is " + meaningOfLife() + ".") end
Line 435 ⟶ 437:
{{out}}
<pre>
emal.exe Org\RosettaCode\
The meaning of life is 42.
</pre>
<syntaxhighlight lang="emal">
^|Then we create a new module named Modulinos.emal,
|this imports the previous module.
|^
in Org:RosettaCode
load :
type
fun main = int by List args
writeLine("Who says the meaning of life is " +
return 0
end
Line 450 ⟶ 455:
{{out}}
<pre>
emal.exe Org\RosettaCode\
Who says the meaning of life is 42?
</pre>
Line 2,014 ⟶ 2,019:
First we create a module for our modulino:
<syntaxhighlight lang="
var MeaningOfLife = Fn.new { 42 }
Line 2,024 ⟶ 2,029:
// Check if it's being used as a library or not.
import "os" for Process
if (Process.allArguments[1] == "
main.call()
}</syntaxhighlight>
Line 2,035 ⟶ 2,040:
Next we create another module which imports the modulino:
<syntaxhighlight lang="
import "./
var main = Fn.new {
|