Hack Forums
[C] Is there any way to call functions in a Ternary Operator? - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [C] Is there any way to call functions in a Ternary Operator? (/showthread.php?tid=6012021)



Is there any way to call functions in a Ternary Operator? - pms - Sep 29, 2019

Or do i have to type :

if(a < b){
firstFunction();
}
else{
secondFunction();
}

is there any way i can do that using a Ternary Operator?


RE: Is there any way to call functions in a Ternary Operator? - YouthInAsia - Sep 29, 2019

a < b ? firstFunction() : secondFunction();