Name |
println()换行打印 |
||||
Examples |
String s = “The size is “; int w = 1920; int h = 1080; println(s); println(w, “x”, h);
// This program writes to the console: // The size is // 1920 x 1080
print(“begin- “); float f = 0.3; int i = 1024; print(“f is ” + f + ” and i is ” + 1024); String s = ” -end”; println(s);
// This program writes to the console: // “begin- f is 0.3 and i is 1024 -end” |
||||
Description |
The println() function writes to the console area, the black rectangle at the bottom of the Processing environment. This function is often helpful for looking at the data a program is producing. Each call to this function creates a new line of output. More than one parameter can be passed into the function by separating them with commas. Alternatively, individual elements can be separated with quotes (“”) and joined with the addition operator (+). Before Processing 2.1, println() was used to write array data to the console. Now, use printArray()to write array data to the console. Note that the console is relatively slow. It works well for occasional messages, but does not support high-speed, real-time output (such as at 60 frames per second). It should also be noted, that a println() within a for loop can sometimes lock up the program, and cause the sketch to freeze. println () 函数写入控制台区域, 即处理环境底部的黑色矩形。此函数通常有助于查看程序正在生成的数据。对此函数的每次调用都会创建一个新的输出行。可以通过将多个参数与逗号隔开来传递到函数中。或者, 可以用引号 (“”) 分隔各个元素, 并与加法运算符 (+) 联接。
在处理2.1 之前, println () 用于将数组数据写入控制台。现在, 使用 printarray () 将数组数据写入控制台。
请注意, 控制台相对较慢。它对偶尔的消息很有效, 但不支持高速、real-time 的输出 (如每秒60帧)。还应该注意, for 循环中的 println () 有时会锁定程序, 并导致草图冻结。 |
||||
Syntax |
println() println(what) println(variables) |
||||
Parameters |
|
||||
Returns |
void |
||||
Related |
print() |
- 本文固定链接: http://iprocessing.cn/2017/08/01/println换行打印/
- 转载请注明: 卡萨布兰卡 于 Processing编程艺术 发表