编程
Fundamentals
Setting Up Development Environment
UnigineScript
High-Level Systems
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine and Tools
GUI
Double Precision Coordinates
应用程序接口
Containers
Common Functionality
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
GUI-Related Classes
Math Functionality
Node-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
Rendering-Related Classes

For循环语句

UnigineScript内一种十分灵活的循环。只要条件为 for循环语句会一直执行。但如果条件一开始就为,for循环语句就不会执行。

语法

源代码 (UnigineScript)
for(initial_instruction; loop_condition; loop_increment) { 
	// some_code; 
}

部分

  • 在第一个循环迭代开始之前,执行initial_instruction
  • 在每个(包括第一个)循环迭代之前检查loop_condition
  • 每个迭代完成后执行loop_increment

示例

源代码 (UnigineScript)
for(int i = 0, j = 10; i < 10 && j > 0; i++, j -= 2) {
	log.message("%d ",i);
}

// 结果为: 0 1 2 3 4
最新更新: 2017-07-03