vipsi - the friendly vip script interpreter

Operators

Select "? :"

<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 … then
The
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 … then
If the
Flow controlcondition is true, Flow control: if … then
Flow control: try … then
then
Flow control: if … then
Flow control: try … then
the
first Glossary: Valuevalue is selected, Flow control: if … then
Flow control: try … then
else
Flow control: if … then
Flow control: try … then
the
second Glossary: Valuevalue is selected as Flow control: if … then
Flow control: try … then
the
result of Flow control: if … then
Flow control: try … then
the
operation.

Pruning: Depending on Flow control: if … then
Flow control: try … then
the
Flow controlcondition either Flow control: if … then
Flow control: try … then
the
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 … then
the
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: Operand
operand
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 … then
The
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 … then
the
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.

Valid HTML   Valid CSS