From f1988f2748cc14445ee9454b1aec12135c3f1d94 Mon Sep 17 00:00:00 2001 From: DemonExposer Date: Fri, 19 Aug 2022 16:18:41 +0200 Subject: [PATCH] Added an example for importing a file --- examples/importing/main.gsl | 3 +++ examples/importing/math.gsl | 9 +++++++++ 2 files changed, 12 insertions(+) create mode 100644 examples/importing/main.gsl create mode 100644 examples/importing/math.gsl diff --git a/examples/importing/main.gsl b/examples/importing/main.gsl new file mode 100644 index 0000000..ca1bde3 --- /dev/null +++ b/examples/importing/main.gsl @@ -0,0 +1,3 @@ +decl Math = require math + +print(Math.abs(5) : " " : Math.abs(-5)) diff --git a/examples/importing/math.gsl b/examples/importing/math.gsl new file mode 100644 index 0000000..052a601 --- /dev/null +++ b/examples/importing/math.gsl @@ -0,0 +1,9 @@ +function abs(num) { + on (num < 0) { + return (-num) + } + + return (num) +} + +export = {"abs": abs} \ No newline at end of file