Template:Negate

From Angelina Jordan Wiki

Documentation

This template simply negates the "truth value" of its (string) input. (See the examples below for details.) It should only be used inside of other templates and not in articles directly.

Usage

  • {{negate|input}}

Examples

  1. {{negate}} ⇒ 1
  2. {{negate|}} ⇒ 1
  3. {{negate| }} ⇒ 1
  4. {{negate|0}}
  5. {{negate|1}}
  6. {{negate|TRUE}}
  7. {{negate|FALSE}}
  8. {{negate||2}} ⇒ 1
  9. {{negate|param=true}} ⇒ 1
  10. {{negate|{{{1}}}}}
  11. {{negate|{{{1|}}}}} ⇒ 1
  12. {{negate| {{{1|}}} }} ⇒ 1

As can be seen in these examples, if there is no input, empty input, or input only containing whitespace (examples 1–3), then that is considered false input and therefore the template returns a true value (the single character "1"). If the input contains at least one non-whitespace character (examples 4–7), then it is considered true and the template returns a false value (the empty string ""). Everything is based on the first positional parameter only; all other parameters are ignored (examples 8–9, using the second positional parameter and a named parameter, respectively).

In the final three examples (10–12), note that the parameter 1 is undefined, since this documentation is generated by calling a template without any parameters. For this reason, {{{1}}} evaluates to the literal string "{{{1}}}" but {{{1|}}}, which specifies an empty default value, evaluates to the empty string "". (This is the typical behavior of parameters inside of template code — see the help at MediaWiki.org or Wikipedia for more information.)

Aliases

  • {{NOT}}

See also