foreach n in ([1..10]){print(n); if(n%5==0){println(); continue;} print(", ")} // or foreach n in ([1..10]){print(n,(n%5) and ", " or "\n")}