zoukankan      html  css  js  c++  java
  • Swift

    //: Playground - noun: a place where people can play
    
    import UIKit
    
    // for-in
    for i in -99...99
    {
        i * i
    }
    
    let array = ["Rinpe", "Bobo", "Lili"]
    for (index, name) in array.enumerate()
    {
        print("(index), (name)");
    }
    
    for (_, name) in array.enumerate()
    {
        print("(name)")
    }
    
    let dict = [1:"Rinpe", 2:"Bobo", 3:"Lili"]
    for (key, value) in dict {
        print("(key) - (value)")
    }
    
    // for
    
    for var i = 0; i <= 100; i++
    {
        i * i
    }
    
    // while
    
    var i = 100;
    while i > 0     // 符合这个条件才循环下去
    {
        i--
    }
    
    // do-while(无论条件是否符合, 都会执行一次)
    i = 100
    repeat
    {
        i--
    } while i == 100
    
    i
    

      

  • 相关阅读:
    人物-商界-张近东:张近东
    人物-商界-许家印:许家印
    iptables-save
    iptables-restore
    iptables
    ipcs
    ipcclean
    ipc
    ip
    install-info
  • 原文地址:https://www.cnblogs.com/Rinpe/p/5050809.html
Copyright © 2011-2022 走看看