View Problem

Perform different actions depending on several boolean conditions (IF .. THEN .. ELSIF .. ELSE)

DiskEdit
python
if age > 84:
print 'You are really ancient'
elif age > 30:
print 'You are middle-aged'
else:
print 'You are young'
DiskEdit
clojure
(println
(condp <= age
84 "You are really ancient"
30 "You are middle aged"
"You are young"))
ExpandDiskEdit
cpp C++/CLI .NET 2.0
if (age > 84) Console::WriteLine("You are really ancient");
else if (age > 30) Console::WriteLine("You are middle-aged");
else Console::WriteLine("You are young");
ExpandDiskEdit
cpp C++/CLI .NET 2.0
Console::WriteLine("You are {0}", (age > 84 ? "really ancient" : age > 30 ? "middle-aged" : "young"));
ExpandDiskEdit
cpp
std::cout << "You are " << (age > 84 ? "really ancient" : age > 30 ? "middle-aged" : "young") << std::endl;

Submit a new solution for python, clojure, or cpp
There are 17 other solutions in additional languages (csharp, erlang, fantom, fsharp ...)