Examples:
Ruby:
variable = 5
if variable > 4 then
puts variable.to_s + " is over 4"
puts "It's exactly five" if variable == 5
elsif variable == 4 then
puts "It's four"
end
(1..10).each do |i|
puts i.to_s + " a thousand."
end
Python:
variable = 5
if variable > 4:
print variable, "is over 4"
if variable == 5:
print "It's exactly five"
elif variable == 4:
print "It's four"
for i in range(1,11):
print i, "a thousand."
C++:
int variable = 5;
if (variable > 4)
{
std::cout << variable << " is over 4" << std::endl;
if (variable == 5)
std::cout << "It's exactly five" << std::endl;
}
else if (variable == 4)
{
std::cout << "It's four" << std::endl;
}
for (int i = 1; i < 11; ++i)
{
std::cout << i << " a thousand" << std::endl;
}