Jump to content

Include a file: Difference between revisions

Added Wren
(Added Wren)
Line 2,151:
Not in preprocessor -- include_counter = 3
Not in preprocessor -- include_counter = 3</lang>
 
=={{header|Wren}}==
{{libheader|Wren-fmt}}
{{libheader|Wren-math}}
The ''import'' statement in Wren behaves in much the same way as the ''#include'' directive in C. However, there are some important differences:
 
1. You have to specify which top-level variable names you want to import using the ''for'' clause.
 
2. A ''module'' (Wren's term for a source code file) is only ever loaded once.
 
3. All ''core'' modules are imported automatically without the need for an ''import'' statement.
 
3. The code for an imported module is executed in a separate fiber from the main module.
 
Here's a simple example.
<lang ecmascript>import "/fmt" for Fmt // imports the Fmt module and makes the 'Fmt' class available
import "/math" for Int // imports the Math module and makes the 'Int' class available
System.print("The maximum safe integer in Wren is %(Fmt.dc(0, Int.maxSafe)).")</lang>
 
{{out}}
<pre>
The maximum safe integer in Wren is 9,007,199,254,740,991.
</pre>
 
=={{header|x86 Assembly}}==
9,485

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.