Skip to content

Commit

Permalink
feat(sample): add sample for import
Browse files Browse the repository at this point in the history
  • Loading branch information
SkuldNorniern committed Feb 14, 2024
1 parent f122134 commit 868aeeb
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
19 changes: 19 additions & 0 deletions sample/import_statement/fibonacci.nk
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
fn adder(i64:a, i64:b) -> i64
{
return a + b;
}

fn fibonacci(i64:n) -> i64
{
let:i64 return_val = 0;
if(n < 2)
{
return_val = n;
}
else {
return_val = adder(fibonacci( n-1 ), fibonacci( n-2 ));

}
return return_val;
}

7 changes: 7 additions & 0 deletions sample/import_statement/import.nk
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
inject "./sample/import_statement/fibonacci.nk";

fn main() -> i64
{
let:i64 result = fibonacci(47);
return result;
}

0 comments on commit 868aeeb

Please sign in to comment.