about summary refs log tree commit diff stats
path: root/js/baba-yaga/error-handling-chain.baba
diff options
context:
space:
mode:
Diffstat (limited to 'js/baba-yaga/error-handling-chain.baba')
-rw-r--r--js/baba-yaga/error-handling-chain.baba17
1 files changed, 0 insertions, 17 deletions
diff --git a/js/baba-yaga/error-handling-chain.baba b/js/baba-yaga/error-handling-chain.baba
deleted file mode 100644
index 035fff0..0000000
--- a/js/baba-yaga/error-handling-chain.baba
+++ /dev/null
@@ -1,17 +0,0 @@
-processData : input ->
-  when (parseNumber input) is
-    Err msg then Err msg
-    Ok num then 
-      when (num / 2) > 10 is
-        true then Ok (num / 2)
-        false then Err "Result too small";
-
-parseNumber : str ->
-  when str is
-    "0" then Ok 0
-    "10" then Ok 10  
-    "20" then Ok 20
-    _ then Err "Invalid number";
-
-result : processData "20";  // Returns Err "Result too small" (10 is not > 10)
-io.out result;
\ No newline at end of file