Using the GHC Compiler:
1. Create a file - baby.hs
2. Open the WinGHCi
ghc> :cd D:\2011\Learning_Workspace\2011_Learnings\Haskell_Learnings
ghci> :load "baby.hs" ------loads the module.
Haskell - if should always have else. both parts if & else should return expression.
Functions - Rules
1. Cannot begin with Uppercase letter.
2. Name can be conanO'Brien = "It's a-me, Conan O'Brien!"
3. When a function doesn't take any parameters, we usually say it's a definition (or a name).
1. Create a file - baby.hs
2. Open the WinGHCi
ghc> :cd D:\2011\Learning_Workspace\2011_Learnings\Haskell_Learnings
ghci> :load "baby.hs" ------loads the module.
- doubleSmallNumber x = if x > 100
- then x
- else x*2
Haskell - if should always have else. both parts if & else should return expression.
Functions - Rules
1. Cannot begin with Uppercase letter.
2. Name can be conanO'Brien = "It's a-me, Conan O'Brien!"
3. When a function doesn't take any parameters, we usually say it's a definition (or a name).
No comments:
Post a Comment