lundi 29 avril 2019

Simplify if-statements in function

The following function includes multiple if-then-else statements. Is it possible to simplify the code without using the inner if-then-else statement?

f x y z = if y >= 15 
            then (if y < 23 then x*5 else f (x+4) (y+7) z) 
            else f(x+4) (y+7) z

Aucun commentaire:

Enregistrer un commentaire