# Is it true or false? [closed]

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"

# Input

Anything. This can be taken from STDIN or as command line arguments.

# Output

Its truthy or falsy value in your language. This should be preferably be denoted by true/false or 1/0. If not, please state what is the output for each.

For example, 1, "hello" and [0,2] are all truthy in Python but the third isn't in MATL (? Correct me if wrong)

# Rules

• 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 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, bool isn't a valid answer in Python.

Good luck!

## closed as too broad by ATaco, Comrade SparklePony, Mego♦, fireflame241, user42649 May 26 '17 at 0:40

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

• This is so trivial it's unbelievable. – Stephen May 25 '17 at 23:15
• Possible duplicate of Is it truthy or falsy? – ATaco May 25 '17 at 23:40
• It isn't a duplicate, and I don't think it's closeable under our current rules (if it does, "unclear" would be the only reasonable choice; because the challenge doesn't explain how it works for languages that don't have a Boolean-equivalent, such as Prolog, Incident, and Three Star Programmer). That said, it might be worth a meta post about what we should do with extremely-trivial-in-practical-language challenges like this. – user62131 May 25 '17 at 23:52
• Why full programs only? – CalculatorFeline May 26 '17 at 0:08

# Japt, 3 2 bytes

o


Needs the -d flag.

Try it online!

• Beat me to it; I've really gotta get my brain thinking in Japt over JS 'round here! – Shaggy May 25 '17 at 23:19
• Also o with the -d flag would work. Though it would still be 3 bytes. – powelles May 25 '17 at 23:52
• @powelles, for some reason flags only count as 1 byte. – Shaggy May 26 '17 at 7:28

# JavaScript (ES6), 6 bytes

i=>!!i

• OP wants a full program, not a funciton. – Stephen May 25 '17 at 23:15
• alert(!!prompt()) is more valid. – ATaco May 26 '17 at 1:54

# Convex, 2 bytes

!!


Try it online!

# RProgN 2, 2 bytes

¬¬


Try it online!

# Brain-Flak, 14 bytes

({()(<()>)}<>)


Try it online!

## Explanation

(        #Set up a push
{       #Execute if truthy
()     #Create 1 value
(<()>) #Ensure a 0 to exit the loop
}
<>      #Switch stacks
)        #Push the value


# RProgN, 1 char, 3 bytes

‼


Added this because I've never really gotten a use for the truthy function, and I wanted to.

Try it online!

• It's a full program too, right? – CalculatorFeline May 26 '17 at 0:09
• Of course. You can see that functionality at the TIO. – ATaco May 26 '17 at 0:10

# Jelly,  4  2 bytes

ṆṆ


Full program returning 1 for Truthy and 0 for Falsy.

Try it online!

### How?

ṆṆ - Main link: x
Ṇ  - non-vectorising logical not
Ṇ - non-vectorising logical not


# Python 2, 28 27 bytes

print(input()and 1>0or 0>1)


Less trivial than just print(bool(input())). String input must be given in quotes as per Python 2 requirements.

-1 byte thanks to ovs

• print(input()and 1>0or 0>1) for 27 bytes – ovs May 26 '17 at 7:27
• Wouldn't print(input()!=0) work as well? – Mr. Xcoder May 26 '17 at 9:44
• @Mr.Xcoder thus would give a false positive for [] – ovs May 27 '17 at 6:17
• @ovs ooo, nice, thanks! – HyperNeutrino May 27 '17 at 6:22