Ternary operator

ID204
Link ReferenceNot set
Link CreditsNot set
Link Technical DocumentationNot set
PlCodelangPython
PlGroupFallunterscheidung
PlItemTitleTernary operator
CodethisVar = "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