Template:Cond
Template:Cond
| このテンプレートは34,000以上のページで使われています。 余計な混乱やサーバーへの負荷を避けるために、どんな変更でも最初はテンプレートのサンドボックス・サブページ、テストケース・サブページもしくはあなた自身の利用者スペースのページで試すべきです。そうすれば、試した変更を1度の編集でこのテンプレートに加えることができます。しかし、最初にあなたの提案した変更を、この項目のノートで議論するようにお願いします。 |
複数のif文を順番に評価し、最初に真となったif文の値を返します。
引数
{{{1}}} から順に評価し、空ではない条件が有り次第、対応する値を出力する。
| 引数 | 指定内容 | 既定値 | 説明 |
|---|---|---|---|
| 1 | 条件 | 空 | 引数2 を出力する条件。17までの奇数 |
| 2 | 出力する値 | {{{2}}} | 引数1 が空でなければ出力する。18までの偶数 |
使用例
{{cond| {{{test1|}}} | val1 | {{{test2|}}} | val2 | else | default_value }}
この場合、
- test1 が指定されていれば、val1 を
- test1 が指定されておらず test2 が指定されていれば、val2 を
- test1 も test2 も指定されていなければ、default_value を
表示します。
関連項目
- {{ifempty}}
Content Disclaimer
Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.
- The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
- There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
- It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
- Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
- Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.