Difference between revisions of "Template:Max"

From blackwiki
Jump to navigation Jump to search
imported>MSGJ
m (whitespace tweaks)
imported>Jimp
(ignore non-numeric non-empty input)
Line 1: Line 1:
{{#if:{{{1|}}}
+
<includeonly>{{#expr:{{#switch:<!--
|{{#expr:{{#if:{{{2|}}}
+
-->{{#iferror:{{#expr:({{{1|}}})*1}}|0|1}}<!--
  |{{#if:{{{3|}}}
+
-->{{#iferror:{{#expr:({{{2|}}})*1}}|0|1}}<!--
  |{{#ifexpr:({{{1}}})>({{{2}}})
+
-->{{#iferror:{{#expr:({{{3|}}})*1}}|0|1}}
    |{{#ifexpr:({{{1}}})>({{{3}}})
+
|111={{max/3|({{{1}}})|({{{2}}})|({{{3}}})}}
    |{{{1}}}
+
|110={{max/2|({{{1}}})|({{{2}}})}}
    |{{{3}}}
+
|100={{{1}}}
    }}
+
|101={{max/2|({{{1}}})|({{{3}}})}}
    |{{#ifexpr:({{{2}}})>({{{3}}})
+
|011={{max/2|({{{2}}})|({{{3}}})}}
    |{{{2}}}
+
|010={{{2}}}
    |{{{3}}}
+
|001={{{3}}}
    }}
+
}}}}</includeonly><noinclude>
  }}
 
  |{{#ifexpr:({{{1}}})>({{{2}}})
 
    |{{{1}}}
 
    |{{{2}}}
 
  }}
 
  }}
 
  |{{{1}}}
 
}}}}
 
}}<noinclude>
 
 
{{Documentation}}
 
{{Documentation}}
 
</noinclude>
 
</noinclude>

Revision as of 07:50, 14 October 2011

Template documentation[view] [edit] [history] [purge]

Evaluates and returns the maximum of a list of numeric values. The parameters can be numeric expressions that will be evaluated. Empty or missing parameters are ignored.

Usage

Syntax
{{max | value1 | value2 | value3 | value4 | ... }}
Examples
{{max}}
{{max|}}
{{max|-7}} → -7
{{max|-7|}} → -7
{{max|-7|5}}Expression error: Unexpected < operator.
{{max|-7|5|}}Expression error: Unexpected < operator.
{{max|-7|5|8}}Expression error: Unexpected < operator.
{{max|40*41|300+30}}Expression error: Unexpected < operator.
{{max|100+10|300+30|200+20}}Expression error: Unexpected < operator.

TemplateData

This is the TemplateData documentation for this template used by VisualEditor and other tools; see the monthly parameter usage report for this template.

TemplateData for Max

Evaluates and returns the maximum of a list of numeric values.

Template parameters

ParameterDescriptionTypeStatus
First value1

The first value, a number or expression, e.g. '10*20+30'

Stringrequired
Second value2

The second value, many more parameters can be specified

Stringoptional

See also