I cannot believe that this hasn't been done before but I may be wrong. If so, just close as dupe.
This challenge is very similar to Is it truthy or falsy? but, IMO, isn't close enough to be a dupe. That has predefined "falsy" variables that all languages must use, some of which aren't even falsy; this uses your own falsy values.
Your task is to take an input, evaluate it and output whether it is truthy or falsy in your language.
The "evaluate" part is just so that the input isn't always a string containing the input. For example an input of
0 would be falsy in almost all languages even if
"0" is truthy. It simply means, "convert it into its native type"
Anything. This can be taken from STDIN or as command line arguments.
Its truthy or falsy value in your language. This should be preferably be denoted by
1/0. If not, please state what is the output for each.
[0,2] are all truthy in Python but the third isn't in MATL (? Correct me if wrong)
- There must be 2 unique identifiers for truthy and falsy. You can't just say
numbers are true and symbols are false
- Submissions must be full programs
- This is a code-golf but I have a feeling that a challenge this trivial might become a catalogue so if that happens, I will update the body to contain normal catalogue rules.
- Of course, builtins are allowed but must be part of a full program. For example,
boolisn't a valid answer in Python.