[Haskell-beginners] don't understand this

Ozgur Akgun ozgurakgun at gmail.com
Mon Jun 27 15:43:56 CEST 2011


Hi.

On 27 June 2011 16:33, Roelof Wobben <rwobben at hotmail.com> wrote:

> let lucky 7 = "Lucky number seven"
>  let lucky x = "Sorry, you're out of luck, pal!"
>
> But if I do lucky 7 or lucky 2 I always get the last sentence.
>

The second let binding shadows the first one. Try:

let lucky 7 = "Lucky!"; lucky x = "No luck this time."

Or even better, write this in a file and load it into ghci.

lucky 7 = "Lucky!"
lucky x = "No luck this time."

HTH,
Ozgur
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20110627/65246b28/attachment.htm>


More information about the Beginners mailing list