Do/while problem


#1


https://www.codecademy.com/en/courses/javascript-beginner-en-ASGIv/2/4?curriculum_id=506324b3a7dffd00020bf661#


SyntaxError: Unexpected end of input


var u = true;
while(u){
    console.log("first");
    u = 0;
}
for( u = 0; u < 3; u++) {
    console.log(u);
}

var condition = false;
do {
    console.log("I'm printed once!");
} while(condition);

var abc = false;
do {
    console.log("smt smt smt");
    while(abc);
}

when I add the last do/while the error occurs. i thought it is same as the previous one. can't find the difference and problem.


#2

Look at your closing curly brace
Correct syntax do while

do{
//code
} while (condition);

#3

do {
console.log("smt smt smt");
while(abc); // shoud be oustside of brackets
}

what @codmakr said


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.