Explorar o código

exercise 3.4: bagFee Bool -> Int

George C. Privon %!s(int64=2) %!d(string=hai) anos
pai
achega
f09366476a
Modificáronse 1 ficheiros con 12 adicións e 0 borrados
  1. 12 0
      03-typesandentities/exercises/ex3.4.hs

+ 12 - 0
03-typesandentities/exercises/ex3.4.hs

@@ -0,0 +1,12 @@
+-- Exercise 3.4
+-- George C. Privon
+-- 2023-09-05
+
+bagFee :: Bool -> Int
+bagFee x = if x
+    then 100
+    else 0
+
+bagFee2 :: Bool -> Int
+bagFee2 False = 0
+bagFee2 True = 100