Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

User:Horblegorble/Sandbox/Template/Bool

Revision as of 16:42, 12 August 2023 by Horblegorble (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Case-insensitive conversion of 'truthy' and 'falsey' input to '1' or '0'.
All other input is converted to 'UNDEFINED'.

Intended for use in `#ifexpr` templates.
e.g. {{#ifexpr: {{Bool | {{{input}}} }} | true | false }}


input-output table:

input output
{{Bool|}} 0
{{Bool|1}} 1
{{Bool|0}} 0
{{Bool|yes}} 1
{{Bool|no}} 0
{{Bool|true}} 1
{{Bool|false}} 0
{{Bool|Yes}} 1
{{Bool|YES}} 1
{{Bool|No}} 0
{{Bool|NO}} 0
{{Bool|True}} 1
{{Bool|TRUE}} 1
{{Bool|False}} 0
{{Bool|FALSE}} 0
{{Bool|other}} UNDEFINED
Cookies help us deliver our services. By using our services, you agree to our use of cookies.