+ (addition)

本参考资料用于Processing 3.0+。 如果你使用的是前一版本,请在使用软件帮助菜单内的参考资料。. If you see any errors or have suggestions, please let us know. If you prefer a more technical reference, visit the Processing Core Javadoc and Libraries Javadoc.

名称

+ (addition)

示例

int
a = 50 + 5;

 // Sets 'a' to 55
int b = a + 5;

 
// Sets 'b' to 60 

 String s1 = "Chernenko";

String s2 = "Brezhnev";

String sc1 = s1 + s2;

String sc2 = s1 + ", Andropov, " + s2;

println(sc1);

// Prints "ChernenkoBrezhnev"
println(sc2);

// Prints "Chernenko, Andropov, Brezhnev" 

 String s1 = "Gorbachev";

int i = 1987;

String sc1 = s1 + i;

println(sc1);

// Prints "Gorbachev1987" 
描述 Adds two values or concatenates string values. As a mathematical operator, it calculates the sum of two values. As a string operator, it combines two strings into one and converts from primitive datatypes into the String datatype if necessary.
语法
 value1 + value2 
参数
value1 String, int,float, char, byte, boolean
value2 String, int,float, char, byte, boolean
相关 ++ (increment)
+= (add assign)
– (minus)

Updated on October 2, 2018 05:02:16pm EDT

+ (addition)