Hello!
I'd like to know what "?" and ":" function in the instruction below.
int signal = x > y ? +1 : -1 ;
Thank you! Bye!
Silas Justiniano - Brazil.
Hello!
I'd like to know what "?" and ":" function in the instruction below.
int signal = x > y ? +1 : -1 ;
Thank you! Bye!
Silas Justiniano - Brazil.
int signal declares a variable
= is assign men
x > y is a condition
? asks if that condition is true
+1 means that if the condition is true do this
: seperates the true action from the false action
-1 means that if the condition is false do this
; ends the command