Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

is it ok to do this

Name: Anonymous 2007-06-23 13:51 ID:6CyOAcE6

instead of

int f(a) {
if(a == 3) return 1
else return 0;
}

to write

return (a == 3);

? thanks in advance

Name: Anonymous 2007-06-26 13:14 ID:H9Np5te9

>>39
You'll see, if you have

a=a?b:c
then 'a' has to be a boolean. And b and c have to be booleans as well. furthermore, they have to be variables, elsewhere they won't have any sense

a=a?true:false

is the identity.

a=a?false:true

is the negation (I don't know if java bools have an imperative negation method)

a=a?b:true

is equivalent to !a || b, again, an imperative or method handles it.

and so on.




Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List