Help:Conditional expressions

This page describes how to use various parser functions to display different results based on detected conditions in a page or template.

Here is a quick summary of these functions in terms of how they treat their input (the function names are linked to more detailed descriptions of them found below on this page):

  • #if checks the truth value of a string
  • #ifeq checks whether two strings or numbers are equal
  • #switch compares a string to a set of possible values
  • #expr evaluates a mathematical expression
  • #ifexpr evaluates a mathematical expression and acts on the truth value of the result
  • #iferror checks whether a string (often an expression inside of #expr) triggers a parser error
  • #ifexist checks whether a page with a given title exists on the wiki (including image/media files)

For the use of these functions in tables, see Help:Conditional tables.


Developed by StudentB