Is there a reason why I cannot use the following code?
ulong test(int a, int b) { return a == b ? 0 : 1; }
This shows me:
Cannot implicitly convert type 'int' to 'ulong'. An explicit conversion exists (are you missing a cast?)
The following will work:
ulong test(int a, int b) { return false ? 0 : 1; }
I know how to solve a problem. I just want to know the reason.
Thanks.
c # ternary-operator conditional-operator ulong
Marcel niehüsener
source share