To learn it, you gotta 'do' it


var some= 34;
var getToDaChoppa = function(){
  // Write your do/while loop here!
      console.log("Something at least once");
  }while(some < 24){
      console.log("This won't be printed");


Why this code prints out two statements instead of one. Second statement shouldn't be printed out, becouse condition is false or am I wrong?


no? A do while loop always execute at least once (thanks to do) then after the first run of the loop the condition gets checked. So it makes sense that both lines are printed

The whole point of a do while loop is that it execute at least once, no matter the conditin


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