Template:Qif
Da Wikipedia, ła ençiclopedia libara.
| Template proteto – Łe modifighe łe pode èssare proposte 'nte ła pàxena de discussion. |
Sto template realixa la funzsion condizsionale if con le opzsioni 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 funzsiona se usà con subst.
Guida a l'uso
{{qif
|test=VARIABILE_O_PARAMETRO_DA_TESTARE
|then=codice se 'test' non è nullo (vuoto)
|else=codice se 'test' è nullo (vuoto)
}}
El parametro else xè opzsionale. Se pode quindi utilixar la seguente forma:
{{qif
|test=VARIABILE_O_PARAMETRO_DA_TESTARE
|then=codice se 'test' non è nullo (vuoto)
}}
Esempi
| 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 |

