-
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
481 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
import game from './scripts/default.narrat'; | ||
import arrays from './scripts/arrays.narrat'; | ||
|
||
export default [game]; | ||
export default [game, arrays]; |
16 changes: 16 additions & 0 deletions
16
packages/narrat/src/examples/default/scripts/arrays.narrat
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
test_arrays: | ||
var simple (new Array "a" "b" "c" "d") | ||
var index (array_find_index $simple test_find) | ||
"Index: %{$index}" | ||
|
||
test_forEach element index array: | ||
"For each: %{$element} %{$index} %{$array}" | ||
|
||
test_find element index array: | ||
if (== $element "c"): | ||
return true | ||
else: | ||
return false | ||
|
||
test_map element index array: | ||
return (concat $element " mapped") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.