当前位置:网站首页>How to execute a swift for in loop in one step- How can I do a Swift for-in loop with a step?
How to execute a swift for in loop in one step- How can I do a Swift for-in loop with a step?
2022-07-03 03:48:00 【javail】
problem :
With the removal of the traditional C-style for-loop in Swift 3.0 , how can I do the following? Delete Swift 3.0 Chinese traditional C style for After the cycle , How do I do the following ?
for (i = 1; i < max; i+=2) { // Do something}
In Python, the for-in control flow statement has an optional step value: stay Python in ,for-in The control flow statement has an optional step value :
for i in range(1, max, 2): # Do something
But the Swift range operator appears to have no equivalent: however Swift The range operator seems to have no equivalent :
for i in 1..<max { // Do something}
Solution :
Reference resources : https://stackoom.com/en/question/2PBxa边栏推荐
- 可分离债券与可转债
- 静态网页 和 动态网页的区别 & WEB1.0和WEB2.0的区别 & GET 和 POST 的区别
- [mathematical logic] propositional logic (propositional and connective review | propositional formula | connective priority | truth table satisfiable contradiction tautology)
- Nce detail of softmax approximation
- 错误 C2694 “void Logger::log(nvinfer1::ILogger::Severity,const char *)”: 重写虚函数的限制性异常规范比基类虚成员函数
- Recursion: depth first search
- Debug: CD cannot be used in kaggle
- 用Three.js做一个简单的3D场景
- 【DRM】DRM bridge驱动调用流程简单分析
- Download and install captura and configure ffmpeg in captura
猜你喜欢
Hi3536c v100r001c02spc040 cross compiler installation
Use three JS make a simple 3D scene
Makefile demo
Ffmpeg one / more pictures synthetic video
CEPH Shangwen network xUP Nange that releases the power of data
Web session management security issues
node,npm以及yarn下载安装
机械臂速成小指南(八):运动学建模(标准DH法)
Avec trois. JS fait une scène 3D simple
小程序获取用户头像和昵称
随机推荐
PHP generates PDF tcpdf
简易版 微信小程序开发之页面跳转、数据绑定、获取用户信息、获取用户位置信息
npm : 无法将“npm”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。请检查名称的拼写,如果包括路径,请确保路径正确,然后再试一次。
递归使用和多维数组对象变一维数组对象
用Three.js做一个简单的3D场景
Half of 2022 is over, so we must hurry up
递归:深度优先搜索
Some preliminary preparations for QQ applet development: make an appointment for a development account, download and install developer tools, and create QQ applet
redis在服务器linux下的启动的相关命令(安装和配置)
静态网页 和 动态网页的区别 & WEB1.0和WEB2.0的区别 & GET 和 POST 的区别
TCP, the heavyweight guest in tcp/ip model -- Kuige of Shangwen network
How to download pytorch? Where can I download pytorch?
可分离债券与可转债
Docker install and start MySQL service
递归:一维链表和数组
For instruction, uploading pictures and display effect optimization of simple wechat applet development
如何迈向IPv6之IPv6过渡技术-尚文网络奎哥
Cnopendata China Customs Statistics
动态规划:最长回文子串和子序列
SAP UI5 应用开发教程之一百零五 - SAP UI5 Master-Detail 布局模式的联动效果实现明细介绍