FANDOM


This template is used to test and format boolean values.
Usage: {{bool| testvalue | Custom positive response (optional) | Custom negative response (optional) | Custom true test (optional) | Custom true test (optional) | blank= Custom blank response (optional) }}
  • Testvalue is tested against a range of "true" conditions, and returns 0 by default if "false".
  • True values are currently defined as: (not case sensitive)
    • 1
    • Y
    • Yes
    • True
  • Blank returns negative, unless blank= is specified, in which case the Custom blank response is returned
  • Any other testvalue returns false
  • Optional parameter 2 sets a Custom positive response
    • Entering self as 2 returns Testvalue as positive response
  • Optional parameter 3 sets a Custom negative response
    • Entering self as 3 returns Testvalue as negative response
  • Optional parameter 4 and 5 are used to define a Custom true test.
    • Regardless of what 4 and 5 are set as, "1", "Y", "yes", and "true" will always return a positive response.

Examples:

Test Result Expected
{{bool}} 0 0
{{bool|1}} 1 1
{{bool|x}} 0 0
{{bool|0}} 0 0
{{bool| }} 0 0
{{bool|}} 0 0
{{bool|Y}} 1 1
{{bool|Yes}} 1 1
{{bool|truE}} 1 1
{{bool|2}} 0 0
{{bool|No}} 0 0
{{bool|01}} 1 1
{{bool|001}} 1 1
{{bool|011}} 0 0
{{bool|11}} 0 0
{{bool|111}} 0 0
{{bool|100}} 0 0
{{bool|Anything}} 0 0
{{bool|1|Yep|Nope}} Yep Yep
{{bool|0|Yep|Nope}} Nope Nope
{{bool|x|Yep|Nope}} Nope Nope
{{bool| |Yep|Nope}} Nope Nope
{{bool||Yep|Nope}} Nope Nope
{{bool| 1 | number | numbers}} number number
{{bool| 2 | number | numbers}} numbers numbers
{{bool|male|M|F|M|Male}} M M
{{bool|1||}}
{{bool|x||}}
{{bool|0||}}
{{bool|||}}
{{bool|1|1|}} 1 1
{{bool|x|1|}} (blank)
{{bool|0|1|}} (blank)
{{bool| |1|}} (blank)
{{bool| 0 |4=0}} 1 1 (0 is "yes")
{{bool| 1 |4=0}} 1 1 (1 is still default "yes")
{{bool| 2 |4=0}} 0 0 (0 is "yes")
{{bool| x |4=0}} 0 0 (0 is "yes")
{{bool| 0 |0|4=0}} 0 0 (0 is tested "yes", and custom response)
{{bool| 1 |1|4=0}} 1 1 (1 is still "yes")
{{bool| 2 |2|4=0}} 0 0
{{bool| x |x|4=0}} 0 0
{{bool|1|1|0|blank=?}} 1 1
{{bool|x|1|0|blank=?}} 0 0
{{bool|0|1|0|blank=?}} 0 0
{{bool||blank=?}} ? ?
{{bool||1|0|blank=?}} ? ?
{{bool| |1|0|blank=?}} ? ?
{{bool|1|1|0|blank=}} 1 1
{{bool|x|1|0|blank=}} 0 0
{{bool|0|1|0|blank=}} 0 0
{{bool| |1|0|blank=}} (blank)
{{bool||blank=1}} 1 1
{{bool||blank=z}} z z
{{bool||blank=0}} 0 0
{{bool||blank=}} (blank)
{{bool|x|blank=}} 0 0
{{bool|1|1|self}} 1 1
{{bool|x|1|self}} x x
{{bool|0|1|self}} 0 0
{{bool| |1|self}} (blank)
{{bool|1|1|self|q}} 1 1
{{bool|q|1|self|q}} 1 1
{{bool|x|1|self|q}} x x
{{bool|0|1|self|q}} 0 0
{{bool| |1|self|q}} (blank)
{{bool|1|self|0}} 1 1
{{bool|x|self|0}} 0 0
{{bool|0|self|0}} 0 0
{{bool| |self|0}} 0 0
{{bool|1|self|0|q}} 1 1
{{bool|q|self|0|q}} q q
{{bool|x|self|0|q}} 0 0
{{bool|0|self|0|q}} 0 0
{{bool| |self|0|q}} 0 0
{{bool| 0 |self|self|4=0}} 0 0 (returning self = 0)
{{bool| 1 |self|self|4=0}} 1 1
{{bool| 2 |self|self|4=0}} 2 2
{{bool| x |self|self|4=0}} x x
{{bool| |self|self|4=0}}
Community content is available under CC-BY-SA unless otherwise noted.