Local variable may not have been initiated
Answered
- Need more info
- Answered
- Working on it
in
Programming Questions
•
3 years ago
When I run this, I get the error "local variable i may not have been initiated"...I've never gotten this before and I'm not sure why it's popping up... This program barely does anything yet (see code below), it's just the very baby stages of something that's going to do edit distance and hopefully an animation sort of thing...Apologies if there are other errors in it, but I can't get past this one.
Thanks
char [] one;
char [] two;
String sweet;
String sour;
void setup() {
sweet = "sweet";
sour = "sour";
}
void draw() {
noLoop();
Distance(sweet, sour);
}
void Distance (String x, String y) {
one = new char[x.length()];
two = new char[y.length()];
for (int i; i<x.length; i++) {
one[i] = x.charAt(i);
}
for (int b; b<y.length; b++) {
two[b] = y.charAt(b);
}
println (one);
println (two);
}
1