zoukankan      html  css  js  c++  java
  • Swift 循环语句

     // 循环语句

            for var i = 0 ;i < 5 ;i++ {

                

                print("i = (i)")

            }

            

            var j = 0

            for j = 0; j < 10; j++ {

                

                print("j = (j)")

                

            }

            

            // for in 的第一种用法

            // 1.遍历字符串

            let str = "qwertyu"

            

            for temp in str.characters {

                

                print("temp = (temp)")

            }

            

            

            for temp1 in 1...6 {

                print("temp1 = (temp1)")

            }

            

            // while 语句

            /*

            格式

            

            while  布尔值

            

            说明

            

            只有当while 后面的布尔值为false ,才停止 while语句,否则一直执行while语句

            */

            

            var x = 0

            

            while (x < 3)

            {

                print("x = (x)")

                

                x++

                

            }

            

            // repeat while

            /*

            格式:

            repeat {} while 布尔值

            

            说明:

            1:现在执行 repeat 语句

            2:然后在执行while 语句

            3:如果while语句后面的布尔值为false 就停止repeat  while语句,否则就一直执行repeat  while语句

            */

            

            var y = 0

            repeat {

                

                y = y + 1

                

                print("y = (y)")

                

            }while (y < 5)

    1
  • 相关阅读:
    开源.net 混淆器ConfuserEx介绍
    k8s删除namespace失败,状态Terminating解决方案
    java get all threadlocal from thread
    mysql查看索引的大小
    InnoDB一定会在索引中加上主键吗?
    全链路追踪traceId,ThreadLocal与ExecutorService
    redis 批量删除keys
    shell逐行读取excel并执行sql
    Is it possible to create @Around Aspect for feign.Client
    Spring Boot后台启动不打印nohup.out
  • 原文地址:https://www.cnblogs.com/fantasy3588/p/5083336.html
Copyright © 2011-2022 走看看