Issue
I created a method and keep getting an error that I need to include a } at the end of my method. I put the } in and the error is still there! If I then delete that } the same error will pop up on a prior method; and that error wasn't there before. in other words, if i type the } on my most recent method then the error stays there and only there. if i delete it, it duplicates that error on my prior method.
private void putThreeBeepers() {
for (int i = 0; i < 2; i++) {
putBeeper();
move();
}
putBeeper();
}
private void backUp() {
turnAround();
move();
turnAround();
}
Solution
You really want to go to the top of your file and do proper and consistent indention all the way to the bottom.
For example...
private void putThreeBeepers()
{
for (int i = 0; i < 2; i++) {
putBeeper();
move();
}
putBeeper();
}
private void backUp()
{
turnAround();
move();
turnAround();
}
Odds are, somewhere along the line, you are missing a }. Your description isn't super clear, but if the code you posted is how you actually have it formatted in your file then odds are you just missed something somewhere... and poor indentation makes it very hard to spot.
The fact that the message is changing is confusing, but it is the sort of thing you see in these cases.
Answered By - TofuBeer
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.