/haskell_101

Learning Haskell one step at at time

GNU General Public License v3.0GPL-3.0

haskell_101

Learning Haskell one step at at time

1. -- These is single line comment in haskell
2. -{
This is multiline comment
   -}

Functional control Flow

  1. Emphasis is on the "functional" view that the purpose of an expression is to return a value
  2. looping is handled by recursion
  3. A switch concept is handled with "guards and condiitons"

Haskell if/then/else cnstruct

syntax: if condition then expression1 else expression2

haskell function definition

looping with recursion

:{
  countDown i
    | i == 0 = "Take Off!"
    | otherwise = show(i) ++ " "++ countDown(i-1)    --  ++ is string concat
  
:}
countDown 10     --calling the function

Output:

10 9 8 7 6 5 4 3 2 1 Take Off