about summary refs log tree commit diff stats
path: root/js/scripting-lang/scratch_tests/test_fizzbuzz.txt
diff options
context:
space:
mode:
Diffstat (limited to 'js/scripting-lang/scratch_tests/test_fizzbuzz.txt')
-rw-r--r--js/scripting-lang/scratch_tests/test_fizzbuzz.txt16
1 files changed, 16 insertions, 0 deletions
diff --git a/js/scripting-lang/scratch_tests/test_fizzbuzz.txt b/js/scripting-lang/scratch_tests/test_fizzbuzz.txt
new file mode 100644
index 0000000..2529b73
--- /dev/null
+++ b/js/scripting-lang/scratch_tests/test_fizzbuzz.txt
@@ -0,0 +1,16 @@
+/* Test FizzBuzz-style patterns */
+fizzbuzz_test : n ->
+  when (n % 3) (n % 5) is
+    0 0 then "FizzBuzz"
+    0 _ then "Fizz"
+    _ 0 then "Buzz"
+    _ _ then n;
+
+result1 : fizzbuzz_test 15;
+result2 : fizzbuzz_test 3;
+result3 : fizzbuzz_test 5;
+result4 : fizzbuzz_test 7;
+..out result1;
+..out result2;
+..out result3;
+..out result4; 
\ No newline at end of file