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"
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"));

Submit a new solution for java
There are 33 other solutions in additional languages (clojure, cpp, csharp, erlang ...)