Stuck on Level 7 loop da loop Java script

So it says that i need my code to be under 6 statements ,but clearly it is can someone help it would be great. :grinning:

// The code in this loop will repeat forever.
while (true) {
// Move right
this.moveRight(1);
// Move up
this.moveUp(1);
// Move left
this.moveLeft(1);
// Move down
this.moveDown(1);}

Use this.moveRight() instead. The 1 counts as a statement.

If you delete the 1s it will pass.

Also default code for JS Hour of Code uses:

while(True){
instead of
while(true){

Fixed that, thanks! :slight_smile:

I put the following prior to finding this thread and it is giving me the error, “ReferenceError: True is not defined.” can you tell me what I am doing wrong?

while(True){
this.moveRight();
this.moveUp();
this.moveLeft();
this.moveDown();

Everything below the while(True) is indented but does not appear to be showing in my question.

use a lowercase t with true.

Oh, wow. Maybe I misunderstood the previous replies but I thought the true had to be capitalized.
Thank you very much.

It depends on your programming language. Boolean value names (true/false) are not capitalized in JavaScript, Lua, CoffeeScript and ClojureScript; they are capitalized in Python.

1 Like

Thank you so much for helping !!!

1 Like