Review (getting error)


#1


// Write your code below!

var believe = function(){
    
    do {var trust = true
    {console.log ("Can I believe what you are saying") + trust + ("!"); var trust = false}
    
    while(trust) {console.log("You can trust me.")}

for (i=100; i<=0; i-=5){console.log(i)};

}
}
believe();



SyntaxError: Unexpected token '}'. Expected 'while' to end a do-while loop.


#2

usage of do/while would look something like this.

do{
//some code
} while(//something is true);

More about do/while here


#3

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