ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
[TOC] ## 控制流程语句 大 ### if ``` if (isRaining()) { you.bringRainCoat(); } else if (isSnowing()) { you.wearJacket(); } else { car.putTopDown(); } ``` ### for 循环 ``` for (var i = 0; i < 5; i++) { ... } ``` 迭代 ``` var collection = [0, 1, 2]; for (var x in collection) { print(x); // 0 1 2 } ``` ### switch ``` var command = 'OPEN'; switch (command) { case 'CLOSED': executeClosed(); break; case 'PENDING': executePending(); break; default: executeUnknown(); } ```