16 lines
272 B
Text
16 lines
272 B
Text
|
|
let n = 4
|
||
|
|
let buf = Array.Empty(n)
|
||
|
|
|
||
|
|
func rec(idx, begin) {
|
||
|
|
for i in begin..<n {
|
||
|
|
buf[idx] = i
|
||
|
|
for j in 0..idx {
|
||
|
|
print("{0, 2}".Format(buf[j]), terminator: "")
|
||
|
|
}
|
||
|
|
print("")
|
||
|
|
rec(idx + 1, buf[idx] + 1)
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
rec(0, 0)
|