13.11.08

the else function is a LIE.

but i have code that works the way i want it to, so i'm chuffed.

//the else function is a LIE. but the loop is working how i want it to, which is nice.

String[] tokens; //array
int counter;

void setup() {
size(100, 100);


//load file and split up words
String[] lines = loadStrings("words.txt");
String allText = join(lines, " ");
tokens = splitTokens(allText, " ,.?!:;[]-");

}

//so it's now pulling in that sentence and splitting it up.

void draw() {
background(255);
fill(0);

String s = tokens[counter];
counter = (counter +1) % tokens.length;
//look at the words one at a time please



//is the word there?
if (s.equals("happy")) {
println("happy");
noLoop(); //DON'T LOOP IT BAHBEE.

}

if (s.equals("spiffing")) {
println("spiffing");
noLoop(); //DON'T LOOP IT BAHBEE.

}

}

No comments: