|
@@ -136,11 +136,9 @@
|
|
|
</code></pre>
|
|
|
|
|
|
<!-- IMPORTS -->
|
|
|
- <h4 class="section-h4">Import</h4>
|
|
|
- <p><b>NOTE:</b> currently, the path to the imported file is relative to
|
|
|
+ <h4 class="section-h4">Include</h4>
|
|
|
+ <p><b>NOTE:</b> currently, the path to the included file is relative to
|
|
|
the location that the gravity executable was run.</p>
|
|
|
- <p>Gravity supports importing code from other gravity files using the
|
|
|
- import statement:</p>
|
|
|
<pre><code class="swift">
|
|
|
// adder.gravity
|
|
|
func add(x, y) {
|
|
@@ -149,13 +147,18 @@
|
|
|
</code></pre>
|
|
|
<pre><code class="swift">
|
|
|
// main.gravity
|
|
|
- import "adder.gravity"
|
|
|
+ #include "adder.gravity"
|
|
|
|
|
|
func main() {
|
|
|
System.print("5+4=" + add(5,4));
|
|
|
}
|
|
|
</code></pre>
|
|
|
|
|
|
+ <h4 class="section-h4">Import</h4>
|
|
|
+ <p>While #include is used to include file at compilation time, the import statement enables you to load modules at runtime...</p>
|
|
|
+ <!--<p>Gravity supports importing code from other gravity files using the
|
|
|
+ import statement:</p>-->
|
|
|
+
|
|
|
<!-- RESERVED KEYWORDS -->
|
|
|
<h4 class="section-h4">Reserved Keywords</h4>
|
|
|
<p>Like many other programming languages Gravity has some reserved keywords that assumes a very specific meaning in the context of the source code:</p>
|