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'
ExpandDiskEdit
erlang
if
Age > 84 -> io:format("You are really ancient~n");
Age > 30 -> io:format("You are middle-aged~n");
true -> io:format("You are young~n")
end.
ExpandDiskEdit
erlang
case Age of
_ when Age > 84 -> io:format("You are really ancient~n");
_ when Age > 30 -> io:format("You are middle-aged~n");
true -> io:format("You are young~n")
end.
DiskEdit
clojure
(println
(condp <= age
84 "You are really ancient"
30 "You are middle aged"
"You are young"))
DiskEdit
csharp
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");
DiskEdit
csharp
Console.WriteLine("You are {0}", ((age > 84) ? "really ancient" : (age > 30) ? "middle-aged" : "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, erlang, clojure, csharp ...
There are 13 other solutions in additional languages (fantom, fsharp, groovy, java ...)