im new here and need allota help. anyways, when i try to compile a robot, it says:
Reached end of file while parsing. It shows my very last } and says theres something wrong with it. looks sorta like this:
else{
ahead(100);
}
^
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Well. It is very hard to tell when I've only got this code snippet, but I will try anyways. ;-)
Normally when the compiler complains about the curly brackets '{' and '}', then the reason is typically that you miss and ending curly bracket somewhere. You should try counting the number of starting curly brackets '{' and see if it matches the number of ending curly brackets '}'.
For example, this would give the compiler problem you get:
public void run() {
if (getTurnRemaining() == 0) {
fire(1);
}
The reason being that you miss the curly bracket started with the if-statement, so the code should have looked like this:
public void run() {
if (getTurnRemaining() == 0) {
fire(1);
}
}
A good way to find such error is to comment out your code if possible using the / and /. Then you should graduately uncomment complete methods. This way you use a "divide and conquer" to isolate what part of you code that causes the problem. :-)
I hope this helps!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Every opening braces { needs one closing braces }. The only purpose of the extra braces is to provide scope-limit . If you put curly braces in the wrong places or omit curly braces where the braces should be, your program probably won't work at all. Moreover, If you don't indent lines of code in an informative manner , your program will still work correctly, but neither you nor any other programmer will be able to figure out what you were thinking when you wrote the code. The error Reached End of File While Parsing is a compiler error and almost always means that your curly parenthesis are not ending completely or maybe there could be extra parenthesis in the end.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
im new here and need allota help. anyways, when i try to compile a robot, it says:
Reached end of file while parsing. It shows my very last } and says theres something wrong with it. looks sorta like this:
else{
ahead(100);
}
^
Well. It is very hard to tell when I've only got this code snippet, but I will try anyways. ;-)
Normally when the compiler complains about the curly brackets '{' and '}', then the reason is typically that you miss and ending curly bracket somewhere. You should try counting the number of starting curly brackets '{' and see if it matches the number of ending curly brackets '}'.
For example, this would give the compiler problem you get:
public void run() {
if (getTurnRemaining() == 0) {
fire(1);
}
The reason being that you miss the curly bracket started with the if-statement, so the code should have looked like this:
public void run() {
if (getTurnRemaining() == 0) {
fire(1);
}
}
A good way to find such error is to comment out your code if possible using the / and /. Then you should graduately uncomment complete methods. This way you use a "divide and conquer" to isolate what part of you code that causes the problem. :-)
I hope this helps!
Every opening braces { needs one closing braces }. The only purpose of the extra braces is to provide scope-limit . If you put curly braces in the wrong places or omit curly braces where the braces should be, your program probably won't work at all. Moreover, If you don't indent lines of code in an informative manner , your program will still work correctly, but neither you nor any other programmer will be able to figure out what you were thinking when you wrote the code. The error Reached End of File While Parsing is a compiler error and almost always means that your curly parenthesis are not ending completely or maybe there could be extra parenthesis in the end.