Modeło:Qif
Come che se vede
Sto template realixa la funsion condisionale if con le opsioni then e else.
- El parametro else xè facoltativo.
- Sto template gà un comportamento non definio se el parametro test o then (o entrambi) non i vegne specificai.
- Sto template ga un comportamento non definio anca se i vegne fornii parametri diversi da quei richiesti.
Notare che qif non funsiona se usà con subst.
Guida a l'uso
[canbia el còdaxe]{{qif
|test=VARIABILE_O_PARAMETRO_DA_TESTARE
|then=codice se 'test' non è nullo (vuoto)
|else=codice se 'test' è nullo (vuoto)
}}
El parametro else xè opsionale. Se pode quindi utilixar la seguente forma:
{{qif
|test=VARIABILE_O_PARAMETRO_DA_TESTARE
|then=codice se 'test' non è nullo (vuoto)
}}
Esempi
[canbia el còdaxe]| Codice | Risultato |
|---|---|
{{qif
|test={{boolne|foo|bar}}
|then=true
|else=false
}}
|
true |
{{qif
|test={{booleq|foo|bar}}
|then=true
|else=false
}}
|
true |
{{qif
|test=
|then=bar
}}
|
|
{{qif
|test=foo
|then=bar
}}
|
bar |