「テンプレート:Eval」の版間の差分
ナビゲーションに移動
検索に移動
細 (1版) |
(相違点なし)
|
2015年3月14日 (土) 12:15時点における最新版
{{#if:{{#ifexpr:{{{1}}}}}|[expression “{{{1}}}” is wrong]|{{{{{subst|}}}#expr:{{{1}}}}}}}
[edit] [ ] Template documentation
Usage
- Normal evaluation
-
‟{{eval|3 / 4}}”
gives ‟0.75”.‟{{eval|3 * 4}}”
gives ‟12”.‟{{eval|3 + 4}}”
gives ‟7”.‟{{eval|3 - 4}}”
gives ‟-1”.‟{{eval|3 mod 4}}”
gives ‟3”.
- Error handling
-
‟{{eval|3 / 0}}”
gives ‟[expression “3 / 0” is wrong]”, because division by 0 is undefined.‟{{eval|1 + {{eval|3 / 0}}}}”
gives ‟[expression “1 + [expression “3 / 0” is wrong]” is wrong]”, this is a case of nested error messages.
The above documentation is transcluded from テンプレート:Eval/doc. (edit | history) Editors can experiment in this template's sandbox (create | mirror) and testcases (create) pages. Please add categories and interwikis to the /doc subpage. Subpages of this template. |