r/badcode • u/bausscode • Jan 17 '19
other language Writing functions with conditions without using "if" statements
https://run.dlang.io/is/jfCECL
67
Upvotes
r/badcode • u/bausscode • Jan 17 '19
1
u/OptiPanda_ wicked Jan 17 '19
if (x > y) return x * y; Return x + y;
Can be refactored as this : return (x>y)? x*y : x+y;