View Problem

Perform different actions depending on a boolean condition (IF .. THEN .. ELSE)

Given a variable age, if the value is greater than 42 display "You are old", otherwise display "You are young"
DiskEdit
python
if age > 42:
print 'You are old'
else:
print 'You are young'
DiskEdit
python
print age > 42 and 'You are old' or 'You are young'
DiskEdit
csharp
int age = 41;

if (age > 42)

System.Console.WriteLine("You are old");
else
System.Console.WriteLine("You are young");


ExpandDiskEdit
java
if (age > 42) {
System.out.println("You are old");
} else {
System.out.println("You are young");
}
ExpandDiskEdit
java
System.out.println("You are " + ((age>42)?"old":"young"));
ExpandDiskEdit
fantom
if (age > 42)
echo("You are old")
else
echo("You are young")
ExpandDiskEdit
fantom
echo((age > 42) ? "You are old" : "You are young")
DiskEdit
clojure clojure
(def age 41)
(if (> age 42) "You are old" "You are young")

Submit a new solution for python, csharp, java, fantom ...
There are 27 other solutions in additional languages (cpp, erlang, fsharp, groovy ...)