+ 2
Ternary operator syntax for ruby?
3 Respuestas
+ 2
x=1, y=1
( x == y ) ? 'equal' : 'not equal'
This evaluates to 'equal'.
x=1, y=0
( x == y ) ? 'equal' : ' not equal'
and this for 'not equal'
0
x=1, y=1
( x == y ) ? 'equal' : 'not equal'
This evaluates to 'equal'.
x=1, y=0
( x == y ) ? 'equal' : ' not equal'
and this for 'not equal'
0
x=1, y=1
( x == y ) ? 'equal' : 'not equal'
This evaluates to 'equal'.
x=1, y=0
( x == y ) ? 'equal' : ' not equal'
and this for 'not equal'