<value> = <condition> ? <value> : <value>
Operators: Select "? :"Triadic select operator: Operators: Select "? :"select one of two Glossary: Valuevalues based on a Flow controlcondition.
Flow control: if … then Flow control: try … thenThe Flow controlcondition must be a numeric Glossary: Valuevalue Operators: Boolean And with Variable "&&=" Operators: Bitwise And with Variable "&=" Operators: Bitwise And "&" Operators: Boolean And "&&"and is considered 'true' Flow control: if … thenif it is non-zero.
Flow control: if … then Flow control: if … thenIf the Flow controlcondition is true, Flow control: if … then Flow control: try … thenthen Flow control: if … then Flow control: try … thenthe first Glossary: Valuevalue is selected, Flow control: if … then Flow control: try … thenelse Flow control: if … then Flow control: try … thenthe second Glossary: Valuevalue is selected as Flow control: if … then Flow control: try … thenthe result of Flow control: if … then Flow control: try … thenthe operation.
Pruning: Depending on Flow control: if … then Flow control: try … thenthe Flow controlcondition either Flow control: if … then Flow control: try … thenthe first Operators: Boolean Or with Variable "||=" Operators: Bitwise Or with Variable "|=" Operators: Bitwise Or "|" Operators: Boolean Or "||"or second Glossary: Valuevalue is evaluated Operators: Boolean And with Variable "&&=" Operators: Bitwise And with Variable "&=" Operators: Bitwise And "&" Operators: Boolean And "&&"and Flow control: if … then Flow control: try … thenthe other is skipped Operators: Boolean And with Variable "&&=" Operators: Bitwise And with Variable "&=" Operators: Bitwise And "&" Operators: Boolean And "&&"and Operators: Bitwise Not "~" Operators: Boolean Negation "!"not executed Operators: Make Identifier "@"at all. Pruning is especially useful Flow control: if … thenif one Glossary: Operator Glossary: Operandoperand is only valid under certain Flow controlconditions Operators: Boolean And with Variable "&&=" Operators: Bitwise And with Variable "&=" Operators: Bitwise And "&" Operators: Boolean And "&&"and must Operators: Bitwise Not "~" Operators: Boolean Negation "!"not be executed otherwise.
e.g.:
Flow control: returnreturn a>b ? a : b
Flow control: returnreturn 1 ? a : 347rz34834n
Flow control: returnreturn Numeric functions: existsexists(a) ? a : 0
Flow control: returnreturn Numeric functions: countcount(myList)>0 ? myList[1] : ""
Flow control: if … then Flow control: try … thenThe Operators: Select "? :"select operator may be concatenated:
Instructions: var How does VScript::Value() work?: Var*&var a=2;
Instructions: var How does VScript::Value() work?: Var*&var Z.Z = a==1 ? "foobar" : a==2 ? "Schnerk" : a==4 ? "schubidoo" : "titanic";
In Flow control: if … then Flow control: try … thenthe above example "foobar", "schubidoo" Operators: Boolean And with Variable "&&=" Operators: Bitwise And with Variable "&=" Operators: Bitwise And "&" Operators: Boolean And "&&"and "titanic" are skipped Operators: Boolean And with Variable "&&=" Operators: Bitwise And with Variable "&=" Operators: Bitwise And "&" Operators: Boolean And "&&"and Operators: Bitwise Not "~" Operators: Boolean Negation "!"not executed due to pruning.
|