is there any way for multiple where statement in Haskell -
i tried write 3-4 statement in 1 function error , couldnt , tried :
foo x= | x == foo1 = 5 | x == foo2 =3 | x == foo3 =1 | otherwise =2 foo1= samplefunct1 x foo2= samplefunct2 x foo3= samplefunct3 x
i know code bit useless wrote give example mean.
is there can me ? in advance.
remove =
after foo x
, indent code like
foo x | x == foo1 = 5 | x == foo2 =3 | x == foo3 =1 | otherwise =2 foo1 = samplefunct1 x foo2 = samplefunct2 x foo3 = samplefunct3 x
and you're fine.
Comments
Post a Comment