DEV Community

Discussion on: If/else or just if?

Collapse
 
somedood profile image
Basti Ortiz

I'm quite surprised actually. Given the imperative nature of if statements, I wouldn't expect Haskell (of all languages) to be the origin of that term.

Thread Thread
 
fennecdjay profile image
Jérémie Astor

Haskell (among other functional languages, I guess) has guards for pattern matching

sign x |  x >  0        =   1
       |  x == 0        =   0
       |  x <  0        =  -1