テンプレート:Eval

提供:脳科学辞典
2015年3月14日 (土) 12:15時点におけるNijcadmin (トーク | 投稿記録)による版 (1版)
(差分) ← 古い版 | 最新版 (差分) | 新しい版 → (差分)
ナビゲーションに移動 検索に移動
{{#if:{{#ifexpr:{{{1}}}}}|[expression “{{{1}}}” is wrong]|{{{{{subst|}}}#expr:{{{1}}}}}}}
[edit] [purge] Documentation icon 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.