重複迴圈

與 while 迴圈類似,只在迴圈後計算控制語句。因此,迴圈將始終至少執行一次。

var i: Int = 0

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

// 0
// 1
// 2