Difference between revisions of "Vorlage:Switch"

From Wikivoyage association
Jump to: navigation, search
(Vorlage angelegt)
 
Line 1: Line 1:
 
<includeonly>{{{case: {{{1|}}}|{{{default|}}}}}}</includeonly><noinclude>
 
<includeonly>{{{case: {{{1|}}}|{{{default|}}}}}}</includeonly><noinclude>
 +
<div {{FramedBox}}>
 +
== de: ==
 +
 +
*'''Funktion:''' Die Vorlage dient dazu, eine Verzweigung in einer Mehrfachauswahl abhängig von einem vergegebenen Wert vorzunehmen.
 +
*'''Verwendung:'''
 +
<nowiki>{{</nowiki>switch
 +
  |''Zu-testender-Wert''
 +
  |case: 1=Ergebnis 1
 +
  |case: 2=Ergebnis 2
 +
  |case: 3=Ergebnis 3
 +
  |...
 +
  |default=alternatives Ergebnis
 +
<nowiki>}}</nowiki>
 +
*'''Parameter:'''
 +
** <code>Zu-testender-Wert</code> Parameter oder Variable
 +
** <code>case: Wert=Ausgabe</code> Individueller Zweig
 +
*'''Einschränkungen:'''
 +
** Zeichen, von denen bekannt ist, dass sie nicht funktionieren: =|
 +
** Zwischen dem Wert und dem ersten Buchstaben der Ausgabe darf kein Leerraum stehen.
 +
 +
Die Vorlage stammt vom Wikipedia-Nutzer [http://en.wikipedia.org/wiki/User:AzaToth AzaToth].
 +
</div>
 
<div {{FramedBox}}>
 
<div {{FramedBox}}>
 
== en: ==
 
== en: ==
 +
 +
*'''Function:''' The template shows one specific branch out of multiple possible branches, dependent on a given value.
 +
*'''Usage:'''
 
  <nowiki>{{</nowiki>switch
 
  <nowiki>{{</nowiki>switch
 
   |''Value-to-Be-Tested''
 
   |''Value-to-Be-Tested''
   | case: 1=result 1
+
   |case: 1=Result 1
   | case: 2=result 2
+
   |case: 2=Result 2
   | case: 3=result 3
+
   |case: 3=Result 3
   | ...
+
   |...
   | default=result default
+
   |default=Default Result
 
  <nowiki>}}</nowiki>
 
  <nowiki>}}</nowiki>
where ''<code>Value-to-Be-Tested</code>'' is a parameter or a variable.
+
*'''Parameters:'''
 +
** <code>Value-to-Be-Tested</code>'' is a parameter or a variable.
 +
** <code>case: Value=Result</code> specific branch
 +
* '''Constraints:'''
 +
** Characters known not to work are: =|
 +
** There mustn't be any space between the pipe character and the first character.
 +
 
 +
Thhis template was created by the Wikipedia user [http://en.wikipedia.org/wiki/User:AzaToth AzaToth].
 +
</div>
 +
<div {{FramedBox}}>
 +
== Beispiel / Example: ==
 +
 
 +
<nowiki>{{switch
 +
  |{{CURRENTYEAR}}
 +
  |case: 2001=Year 1
 +
  |case: 2002=Year 2
 +
  |case: 2003=Year 3
 +
  |case: 2004=Year 4
 +
  |case: 2005=Year 5
 +
  |case: 2006=Year 6
 +
  |case: 2007=Year 7
 +
  |case: 2008=Year 8
 +
  |case: 2009=Year 9
 +
  |default=Other Year
 +
}}</nowiki>
 +
 
 +
bewirkt /gives
 +
 
 +
{{switch
 +
  |{{CURRENTYEAR}}
 +
  |case: 2001=Year 1
 +
  |case: 2002=Year 2
 +
  |case: 2003=Year 3
 +
  |case: 2004=Year 4
 +
  |case: 2005=Year 5
 +
  |case: 2006=Year 6
 +
  |case: 2007=Year 7
 +
  |case: 2008=Year 8
 +
  |case: 2009=Year 9
 +
  |default=Other Year
 +
}}
 
</div>
 
</div>
</noinclude>
+
__NOTOC__ __NOEDITSECTION__ [[Category:Template:If templates|Switch]]</noinclude>

Revision as of 11:59, 17 October 2006

de:

  • Funktion: Die Vorlage dient dazu, eine Verzweigung in einer Mehrfachauswahl abhängig von einem vergegebenen Wert vorzunehmen.
  • Verwendung:
{{switch
 |Zu-testender-Wert
 |case: 1=Ergebnis 1
 |case: 2=Ergebnis 2
 |case: 3=Ergebnis 3
 |...
 |default=alternatives Ergebnis
}}
  • Parameter:
    • Zu-testender-Wert Parameter oder Variable
    • case: Wert=Ausgabe Individueller Zweig
  • Einschränkungen:
    • Zeichen, von denen bekannt ist, dass sie nicht funktionieren: =|
    • Zwischen dem Wert und dem ersten Buchstaben der Ausgabe darf kein Leerraum stehen.

Die Vorlage stammt vom Wikipedia-Nutzer AzaToth.

en:

  • Function: The template shows one specific branch out of multiple possible branches, dependent on a given value.
  • Usage:
{{switch
 |Value-to-Be-Tested
 |case: 1=Result 1
 |case: 2=Result 2
 |case: 3=Result 3
 |...
 |default=Default Result
}}
  • Parameters:
    • Value-to-Be-Tested is a parameter or a variable.
    • case: Value=Result specific branch
  • Constraints:
    • Characters known not to work are: =|
    • There mustn't be any space between the pipe character and the first character.

Thhis template was created by the Wikipedia user AzaToth.

Beispiel / Example:

{{switch
  |{{CURRENTYEAR}}
  |case: 2001=Year 1
  |case: 2002=Year 2
  |case: 2003=Year 3
  |case: 2004=Year 4
  |case: 2005=Year 5
  |case: 2006=Year 6
  |case: 2007=Year 7
  |case: 2008=Year 8
  |case: 2009=Year 9
  |default=Other Year
 }}

bewirkt /gives

Other Year

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox