Friday 29 April 2016

Haskell: Define variable at GHCi prompt


You can define a variable at GHCi prompt by using ‘let’ keyword.

Prelude> let radius=10
Prelude> pi
3.141592653589793
Prelude> 
Prelude> let area = pi * radius * radius
Prelude> area
314.1592653589793



Previous                                                 Next                                                 Home

No comments:

Post a Comment