Ternary operator
ID | 204 |
---|---|
Link Reference | Not set |
Link Credits | Not set |
Link Technical Documentation | Not set |
PlCodelang | Python |
PlGroup | Fallunterscheidung |
PlItemTitle | Ternary operator |
Code | thisVar = "OK" resultVar = False # [on_true] if [cond] else [on_false] resultVar = True if thisVar == "OK" else False // same as if-else construction if (thisVar == "OK"): resultVar = True else: resultVar = False |
Result Example |