We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello, I have created a string setup and I am trying to use that string in draw however I cant work out how to do this. Reason being, the string is created from a table.
Here is the code:
Table table;
int place;
String myString;
void setup() {
table = loadTable("speadsheet.csv", "header");
println("___________________________________");
//println(table.getRowCount() + " total rows in table");
//println(table.getColumnCount() + " total columns in table");
for (TableRow row : table.rows()) {
int number = row.getInt("number");
String string1 = row.getString("column1");
String string2 = row.getString("column2");
String string3 = row.getString("column3");
String myString = ("Item " + number + " " + string1 + "," + string2 + "," + string3);
println(myString);
}
size(400,400);
background(#FFFFFF);
}
void draw(){
}
Answers
You've got 3 "global" variables declared at the top: table, place & myString.
However, you end up overshadowing myString, by re-declaring it as a local variable inside the loop! [-X
in other words
do
instead of
My answer isn't complete without GoToLoop's one. Actually I have just exemplified his… I believe you should mark his as accepted also. ;)