We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I have completely forgotten how to substitute the value of a variable into a string. Someone please help!
println("The value of a is [" + a + "]");
String s1 = "The value of a is "
In both Java & JS the + operator is overloaded to allow concatenation besides the regular addition:
It's enough for 1 of the operands be a String in order for the concatenation mode to kick in:
int a = 10;
String s1 = "Value is: " + a;
String s2 = a + " is a whole number.";
We can also use function str() in order to convert primitive types to String.
Even whole arrays filled w/ them: https://Processing.org/reference/strconvert_.html