Template:Power

From Meta, a Wikimedia project coordination wiki
Jump to navigation Jump to search

Expression error: Unrecognized punctuation character "{".

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

This template is used for demonstrating the use of Template:For to produce a table.

{{ Power | a | b }} gives ab.

Examples[edit]

Powers of 2:

{{for|, |1|2|3|4|call=power|pc1n=1|pc1v=2|pv=2}} gives 2, 4, 8, 16

Squares:

{{for|, |1|2|3|4|call=power|pc1n=1|pc1v=2|pv=2}} gives 1, 4, 9, 16

Thus:

 ^|{{for|, |2|3|call=x1}}<br>
 2|{{for|, |2|3|call=power|pc1n=1|pc1v=2|pv=2}}<br>
 3|{{for|, |2|3|call=power|pc1n=1|pc1v=3|pv=2}}
----
 ^|{{for|, |{{t array 2|1}}|{{t array 2|2}}|call=x1}}<br>
 2|{{for|, |{{t array 2|1}}|{{t array 2|2}}|call=power|pc1n=1|pc1v=2|pv=2}}<br>
 3|{{for|, |{{t array 2|1}}|{{t array 2|2}}|call=power|pc1n=1|pc1v=3|pv=2}}<br>
----
 ^|{{for|, |{{t array 2|1}}|{{t array 2|2}}|call=x1}}<br>
{{array row 2|col=t array 2|arr=power|row=2}}
{{array row 2|col=t array 2|arr=power|row=3}}

using Template:t array 2 (talk, backlinks, edit) containing:


{{#switch:{{{1}}}|1=2|2=3}}


to specify the desired values of the second argument of the template

and

Template:array row 2 (talk, backlinks, edit) containing:


{{{row}}}|{{for|, |{{t array 2|1}}|{{t array 2|2}}|call=power|pc1n=1|pc1v={{{row}}}|pv=2}}<br>


gives:

^|2, 3
2|4, 8
3|9, 27

^|2, 3
2|4, 8
3|9, 27

^|2, 3
2|4, 8
3|9, 27

See also[edit]