Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Defining a function
- -- Name input1 input2 input3 input[..] = output
- addFive x = x+5
- -- So those work like arguments...
- addFiveInputs x y z a b = x+y+z+a+b
- -- We can give out multiple outputs and stuff like that
- nextFiveItems x = [x+1,x+2,x+3,x+4,x+5]
- -- Also, we can use let in situations too to help define functions
- let superFunction x = x*x in superFunction 30
- -- So here's an example demonstrating some of this...
- twoOutputFunction x y = (x+4,y-3)
- let (p,r) = twoOutputFunction 30 50 in (p,r) -- or something less stupid, lol
- -- All of these functions need to be loaded as a module like an .hs file to test them out.
- -- And the let items need to be commented out too.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement