Template:එසේය-හෝ-නැත/උපදෙස්

මෙම සැකිල්ල, ලැබෙන විවිධ ආකාර වන ප්‍රදානය yes/no ආකාරයෙන් ප්‍රතිදානයක් බවට හරවයි.

භාවිතය

edit

The template discerns five possible logical outputs depending on the first parameter (input if you will).

In its simplest usage these will all be either "yes" or "" (blank — nothing no characters).

  1. {{එසේය-හෝ-නැත|yes}}
    
    result "yes" (also applies to "Yes", "YeS", etc, "Y", "y" and "1")
  2. {{එසේය-හෝ-නැත|no}}
    
    result "" (also applies to "No", "NO", "nO", "N", "n" and "0")
  3. {{එසේය-හෝ-නැත}}
    
    result ""
  4. {{එසේය-හෝ-නැත|¬}}
    
    result ""
  5. {{එසේය-හෝ-නැත|purplemonkeydishwasher}}
    
    result "yes" (also applies to any other value not given above).


Each of these can be over-ridden.

  1. {{එසේය-හෝ-නැත|yes|yes=bacon}}
    
    result "bacon" (also applies to "Yes", "YeS", etc, "Y", "y" and "1")
  2. {{එසේය-හෝ-නැත|no|no=ham}}
    
    result "ham": (also applies to "No", "NO", "nO", "N", "n" and "0")
  3. {{එසේය-හෝ-නැත||blank=eggs}}
    
    result "eggs"
    1. but
      {{එසේය-හෝ-නැත||no=ham}}
      
      result "ham"
    2. and
      {{එසේය-හෝ-නැත||blank=eggs|no=ham}}
      
      result "eggs"
  4. {{එසේය-හෝ-නැත|¬|¬=sausage}}
    
    result "sausage"
  5. {{එසේය-හෝ-නැත|purplemonkeydishwasher|def=cup-of-tea}}
    
    result "cup-of-tea" (also applies to any other value not given above).
    1. but
      {{එසේය-හෝ-නැත|purplemonkeydishwasher|yes=bacon}}
      
      result "bacon"
    2. but
      {{එසේය-හෝ-නැත|purplemonkeydishwasher|def=cup-of-tea|yes=bacon}}
      
      result "cup-of-tea"

This may be used (apparently perversely) thus:

  • {{එසේය-හෝ-නැත|yes|yes=no|no=yes}}
    
    result "no"
  • {{එසේය-හෝ-නැත|no|yes=no|no=yes}}
    
    result "yes"

This creates a logical inversion.

Full parameter list

edit

Unnamed parameter 1= the input value to be evaluated. The other parameters (all named, all optional), are the return values for their respective logical outcome. When set, each one overrules their default return value.

{{එසේය-හෝ-නැත
|
| yes  =
| no   =
| blank=
| ¬    =
| def  =
}}
Overview of {{එසේය-හෝ-නැත}} logical values and their associated texts
Input
parameter 1
(1=)
In code Logical return value Default
return text
Return text when set:
yes=Pos
no=Neg
blank=Blank
¬=Undefined
def=Def
Note
yes, y, 1* {{එසේය-හෝ-නැත|yes}} yes by definition "yes" "Pos" * Case-insensitive (Y=y)
Some Text {{එසේය-හෝ-නැත|Some Text}} yes by default "yes" "Def" "Pos" when def=<omitted>
no, n, 0* {{එසේය-හෝ-නැත|no}} no by definition "" "Neg" * Case-insensitive (N=n)
<blank> {{එසේය-හෝ-නැත|}} blank "" "Blank" "Neg" when blank=<omitted>
1=<blank> {{එසේය-හෝ-නැත|1=}} blank "" "Blank" "Neg" when blank=<omitted>
¬ {{එසේය-හෝ-නැත|¬}} ¬ "" "Undefined"
<omitted> {{එසේය-හෝ-නැත}} ¬ "" "Undefined"

This template normalises an input to be a yes/no output.

Template parameters[Edit template data]

ParameterDescriptionTypeStatus
Value1

The value to be evaluated

Stringrequired
Output on yesyes

Defines a value to output on yes

Stringoptional
Output on nono

Defines a value to output on no

Stringoptional
Output on blank inputblank

Defines a value to output if blank input

Stringoptional
Output on ¬¬

Defines a value to output on ¬

Stringoptional
Definite outputdef

Defines the output when value = yes

Stringoptional