Need help with code


#1

var getToDaChoppa = true;

var getToDaChoppa = function(){

    do { console.log("I'm looping"); } 

         while(getToDaChoppa);

                getToDaChoppa = false;

                        };

getToDaChoppa();

im not that sure about this one, and when i try to submit the code the window just freezes and i have to exit quickly because if i dont it will not go away.

help please ?


#2

Hi again! I remember you :smiley: .

Anyways, you have to remember that the while function is a LOOP. That means there must be two corresponding brackets and no semi colon before the first corresponding bracket.


#3

lol i remember too. this is the syntax it gives me:

do {

// The thing to do at least once!

} while( /* some condition */ );


#4

Oh... wait.... I TOTALLY KNEW THAT :smiley:

Sorry got mixed up with the usual while loop :sweat_smile:. Anyways, a problem in your code is that you named getToDaChoppa AGAIN. You're supposed to make another variable. In my case, I used "vent" (don't ask, I have no idea why I chose "vent" either).

I called "vent" as false, and also put that in the while loop (inside the parentheses, I just forgot the word).

Take out this:


#5

the same thing still happens... :persevere: lol


#6

Yeah show me your code :smiley: (revised)


#7

getToDaChoppa = true;

var getToDaChoppa = function(){

do { console.log("I'm looping"); } 

     while(getToDaChoppa);

            getToDaChoppa = false;

                    };

getToDaChoppa();


#8

No, you have to make a NEW variable. So, like in the

Change it to something like:

var choppa = true;

Also, take out this that's after your while loop:

Change your while thingys inside your parentheses of the while loop to something like:

while(choppa = true);


#9

how's this:

Choppa = true;

var getToDaChoppa = function(){

do { console.log("I'm looping"); } 

     while(Choppa=true);

            Choppa = false;

                    };

getToDaChoppa();


#10

Close. In your form, it would be something like:

var Choppa = true;

var getToDaChoppa = function(){

do { console.log("I'm looping"); }

while(Choppa=true);

Choppa = false;<--- delete

};
getToDaChoppa();

Look at the bolded parts.


#11

still the same thing, don't i need to make a way for my while condition to be false ?


#12

Well.... both ways work. :smiley: Both of them make each of them do the do loop once.


#13

it still freezes up the windows :confused:


#14

i got it, lol had to do this: while(Choppa=false), really appreciate the help man :grin: lol


#15

Oh lol. Really? Well, problem solved, congratulations :smiley:. I was just about to send you my code haha.