You are viewing a single comment's thread. Return to all comments →
I wasn't sure either (new to haskell), but apparently it's a stop condition. (If the input to the function is 1 then it simply does the following: putStrLn "Hello World")
I think it's not the way you said "stop condition", it's a pattern matching for specifying which value the function should return for the given value, in this case: 1
But you're right about saying it simply does the following for 1. :)
Yes, hello_worlds 1 = putStrLn "Hello World" is pattern matching. When the hello_words function is called with input 1, that is the executed line. However, in Haskell, the base of recursions are often expressed with a pattern match, so I think is fair to also say it's a stop condition.
hello_worlds 1 = putStrLn "Hello World"