5/7 please help I'm stuck with this


#1

Can you please help me figure out what is wrong with this code?

Thanks!


#2

If you don't specify what "this code" is, it's pretty hard to tell what is wrong.


#3

sorry, here you go. can you see it now?


#4

There is a semicolon after j++ in the for loop where you should not have one.


#5

yep, that was it. thanks a lot!
any tips on how to spot mistakes, or is just the experience that matters?


#6

Mostly experience of having these error made (or seen) elsewhere. What might help is to distinguish the error e.g. syntax error says that there is something wrong with your syntax (who'd have thought) so you can look for the syntax of a for loop if statement or whatever and compare it to your code. Reference Errors on the other hand indicate that you use a variable without declaring it or defining it. So looking for the mentioned variable might be the key. And if you don't get any of these "real errors" than it is probably a problem with not fitting the requirements of the instruction. So although some are misleading (especially the last category) reading the error message carefully often yields some valuable information on how to solve the error.


#7

That makes sense. Thanks again!