This template is used to produce a simple loop. It is based on Module:String, and there is no limit to the number of iterations it can perform.

Usage

<syntaxhighlight lang="wikitext">String Module Error: function rep expects a number as second parameter, received "times to repeat"</syntaxhighlight>

If string contains an equals sign, you must put "|2=string" instead of "|string".

Examples

Code Output
<syntaxhighlight lang="wikitext" inline>nnnn</syntaxhighlight> nnnn
<syntaxhighlight lang="wikitext" inline>test metest metest metest metest metest metest metest metest metest metest metest metest metest metest metest metest metest metest metest metest metest metest metest metest me</syntaxhighlight> test metest metest metest metest metest metest metest metest metest metest metest metest metest metest metest metest metest metest metest metest metest metest metest metest me
<syntaxhighlight lang="wikitext" inline>2.2517998136852E+15</syntaxhighlight> 2.2517998136852E+15
<syntaxhighlight lang="wikitext" inline>202520252025</syntaxhighlight> 202520252025
<syntaxhighlight lang="wikitext" inline>  MUDA  MUDA  MUDA  MUDA  MUDA  MUDA  MUDA  MUDA  MUDA  MUDA  MUDA  MUDA  MUDA  MUDA!</syntaxhighlight>   MUDA  MUDA  MUDA  MUDA  MUDA  MUDA  MUDA  MUDA  MUDA  MUDA  MUDA  MUDA  MUDA  MUDA!

When the string being replicated includes "=", we have to precede the second parameter with "<syntaxhighlight lang="wikitext" inline>2=</syntaxhighlight>", or use {{=}}.

Code Output
<syntaxhighlight lang="wikitext" inline>=========</syntaxhighlight> =========
<syntaxhighlight lang="wikitext" inline>=========</syntaxhighlight> =========

Surrounding whitespace is always stripped; you must use {{#invoke:string|rep}} instead to preserve it.

Code Output
<syntaxhighlight lang="wikitext" inline> hello hello hello </syntaxhighlight> hello hello hello
<syntaxhighlight lang="wikitext" inline>hellohellohello</syntaxhighlight> hellohellohello

Template data

This is the TemplateData for this template used by TemplateWizard, VisualEditor and other tools. See a monthly parameter usage report for Template:Loop in articles based on its TemplateData.

TemplateData for Loop

The template is used to produce a simple loop of repeated strings.

Template parameters

ParameterDescriptionTypeStatus
Number1

Number of times to repeat

Numberrequired
String2

The string to be repeated. Use {{=}} if the string contains an equals sign.

Stringrequired

See also