Please help with if...return..else | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Please help with if...return..else

using an if.. else .. end structure, create a function named customfunc of two scalar arguments x and y, which does the following: if x is greater than y, return x*y if x is less that y, return (y-x)x if x == y (remember, when we compare, we use == instead of =) return 0 customfunc (x+101) = x; E (y+101) = y; E (y+101) = customfunc (x+101); If x>y Return x*y; Elseif x<y Return (y-x)*x; Elseif x==y Return 0; end

31st Jan 2017, 7:02 PM
Daria Komar
Daria Komar - avatar
1 Answer
0
Notice: Do not use return more than once.
8th Feb 2017, 6:29 AM
Hasan Al-Yazidi
Hasan Al-Yazidi - avatar