Maybe I do not understand ternary operation but
if I am right it's
test ? true : false
So this should give
function toto(x, y)
{
return (x > 0 ? x < 7 ? true : false : false &&
y > 0 ? y < 6 ? true : false : false)
}
true only if 0
but if I do
toto(4,6)
it returns true, why? What am I missing ?
just do like this :
function toto(x, y)
{
return (x > 0 ? x < 7 ? true : false : false ) &&
( y > 0 ? y < 6 ? true : false : false)
}
with the bracket before and after the exp1 and exp2 and yes it's a bit unreadable ^^
edit : I also would do
return (x > 0 && x < 7) && (y > 0 && y < 6)