Conditional Ternary Operator

How to use the conditional ternary operator
(삼항 연산자를 사용하는 법)

** Formula

(Execution part)    +=    (    Condition   )  ?  (True) : (False) ;      

* Example

recordIndex +=           (selectMenu == 0)  ?   -1 : 1 ;  



                           ( Step 2)                                                 ( Step 1) 

First, interpret (Step 1) : if the "selectmenu" is "0" that means the condition is true, 
우선, 스텝 1을 해석해야 합니다. 그 의미는 만약, "Selectmenu" 가 "0" 이면, 조건이 참이므로 

(Step 2)

Please add a value of true(-1) to the recordIndex +,  or 

스텝 2로 넘어가서, "recordIndex"에 참인 값인 "(-1)" 을 더해주세요.  

if the " select menu ==0" (false), please add recordIndex - (1)

만약,  select menu 가 0이 아니라면 (거짓으로),"recordIndex"에 거짓인 값인 "(+1)" 을 더해주세요.  

 


Comments