重复循环

与 while 循环类似,只在循环后计算控制语句。因此,循环将始终至少执行一次。

var i: Int = 0

repeat {
   print(i)
   i += 1
} while i < 3

// 0
// 1
// 2