美文网首页
7.swift-for循环

7.swift-for循环

作者: ChaosHeart | 来源:发表于2021-07-11 13:56 被阅读0次

//: Playground - noun: a place where people can play



import UIKit


//for循环基本写法
for i in 0..<10 {
    print(i);
}

//for循环的特殊写法
//如果一个标志符不需要使用,可以用_代替
for _ in 0...10 {
    print("hello world");
}

// 9->0 怎么实现?
//倒序
for i in (0..<10).reversed() {
    print(i);
}

相关文章

网友评论

      本文标题:7.swift-for循环

      本文链接:https://www.haomeiwen.com/subject/enlzlltx.html