diff options
-rw-r--r-- | js/baba-yaga/crash-course-code.baba | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/js/baba-yaga/crash-course-code.baba b/js/baba-yaga/crash-course-code.baba index 8b94ac5..bae2810 100644 --- a/js/baba-yaga/crash-course-code.baba +++ b/js/baba-yaga/crash-course-code.baba @@ -1,5 +1,4 @@ -// Working Crash Course Examples -// All examples verified to work correctly with proper Baba Yaga syntax +// Baba Yaga in Y Minutes // Test 1: Basic with examples testBasicWith : x y -> @@ -47,12 +46,12 @@ testProcessUserData : user -> normalizedName : str.upper (str.trim user.name); ageGroup : when (user.age < 18) is true then "minor" - _ then when (user.age < 65) is - true then "adult" - _ then "senior"; - status : when user.active is - true then "active" - _ then "inactive"; + _ then when (user.age < 65) is + true then "adult" + _ then "senior"; + status : when user.active is + true then "active" + _ then "inactive"; ) -> { id: user.id, @@ -70,7 +69,7 @@ testValidateOrder : order -> ) -> when allValid is true then Ok order - _ then Err "Order validation failed"; + _ then Err "Order validation failed"; // Test 7: Complex pattern matching with computed values testClassifyTriangle : a b c -> @@ -86,15 +85,15 @@ testClassifyTriangle : a b c -> ) -> when isValid is false then "Invalid triangle" - _ then when isEquilateral is - true then "Equilateral" - _ then when isIsosceles is - true then when isRight is - true then "Right isosceles" - _ then "Isosceles" - _ then when isRight is - true then "Right scalene" - _ then "Scalene"; + _ then when isEquilateral is + true then "Equilateral" + _ then when isIsosceles is + true then when isRight is + true then "Right isosceles" + _ then "Isosceles" + _ then when isRight is + true then "Right scalene" + _ then "Scalene"; // Test 8: Tree operations with with rec testTreeOperations : tree -> |