I came here on Codecademy after I finished C++ courses, to learn Java. However, when the website asked me to write a for loop, it didn't work. At first, I thought that Java's for loops were different. Re-read the guide, and nothing seemed off. My code was: for (int j = 0 ; j < weeklyTemperatures.size() ; j++). The console gave the expected result, although Codecademy said it is wrong. Then, as it kept giving me error messages, I literally copy-pasted the example for and then modified the parameters: for (int j = 0; j < weeklyTemperatures.size(); j++) Surprise, that worked. What is going on? Why does it not accept the ";"s as I place them, with one space before and after every parameter of the for loop?
simply it’s not your fault.Everything you write in the code editor system checker checks it. so it must be the same what the instruction wants from you. In the other environment you can do whatever you want but here you have to do what you are told to do.
so always try to follow the instruction
Because the semi-colon should be right after (), not skip a space. It makes it harder for the system to read.
Having exactly the same issue.
Hey, @jackalack117, the people above commented very useful replies. When you use your compiler, you can put spaces before and after the ";"s of the “for” loop. However, Codecademy’s checking system wants you to put no spaces before the “;”, and one space after. Your for should look like this:
for (int i = 0; i < 5; i++)
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.