View Problem

Perform an action a fixed number of times with a counter

Display the string "10 .. 9 .. 8 .. 7 .. 6 .. 5 .. 4 .. 3 .. 2 .. 1 .. Liftoff!"
DiskEdit
ruby
10.downto(1) { |n| print n, " .. " }
puts "Liftoff!"
DiskEdit
csharp
for (int i = 10; i > 0; i--)
{
Console.Write("{0} .. ", i);
}

Console.WriteLine("Liftoff!");
ExpandDiskEdit
cpp C++/CLI .NET 2.0
for(int i = 10; i != 0; --i) Console::Write("{0} .. ", i);
Console::WriteLine("Liftoff!");
ExpandDiskEdit
fantom
(10..1).each { Env.cur.out.print("$it .. ") }
Env.cur.out.print("Liftoff!")
ExpandDiskEdit
fantom
for (i := 10; i >= 1; i--)
Env.cur.out.print("$i .. ")
Env.cur.out.print("Liftoff!")
ExpandDiskEdit
erlang
fromto(10, 1, -1, fun (X) -> io:format("~B .. ", [X]) end), io:format("Liftoff!~n").
ExpandDiskEdit
erlang
lists:foreach(fun (X) -> io:format("~B .. ", [X]) end, lists:seq(10, 1, -1)), io:format("Liftoff!~n").
DiskEdit
groovy
10.downto(1) { print it + " .. " }
println "Liftoff!"

Submit a new solution for ruby, csharp, cpp, fantom ...
There are 14 other solutions in additional languages (clojure, fsharp, haskell, java ...)