# Continue seems to work like break

**URL:** <https://discourse.codecombat.com/t/continue-seems-to-work-like-break/182>\
**Category:** Solved\
**Created:** [January 8, 2014, 4:24pm UTC](https://discourse.codecombat.com/t/continue-seems-to-work-like-break/182 "2014-01-08T16:24:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![gus](https://avatars.discourse-cdn.com/v4/letter/g/ecc23a/32.png) [@gus](https://discourse.codecombat.com/u/gus)\
**Post date:** [January 8, 2014, 4:24pm UTC](https://discourse.codecombat.com/t/continue-seems-to-work-like-break/182/1 "2014-01-08T16:24:45Z")

</div>

Hey,  
I started playing with code combat yesterday and I think it is pretty cool. While solving Gridmancer, I used `continue` in my javascript. It took me a while to realize that it wasn’t behaving as expected. It seems like it is doing a `break` instead.  
Here is some sample code for Gridmancer that illustrates what I mean. The code below should fill up the map with alternating (checkered) squares but instead it stops after the first.

```
var grid = this.getNavGrid().grid;
var tileSize = 4;
for(var y = 0; y + tileSize < grid.length; y += tileSize) {
    for(var x = 0; x + tileSize < grid[0].length; x += tileSize) {
        if (((x+y)/4)%2 == 0) continue;
        var occupied = grid[y][x].length > 0;
        if(!occupied) {
            this.addRect(x + tileSize / 2, y + tileSize / 2, tileSize, tileSize);
            this.wait(); // Hover over the timeline to help debug!
        }
    }
}

```

And below I have equivalent code that doesn’t use continue which works perfectly.

```
var grid = this.getNavGrid().grid;
var tileSize = 4;
for(var y = 0; y + tileSize < grid.length; y += tileSize) {
    for(var x = 0; x + tileSize < grid[0].length; x += tileSize) {
        if (((x+y)/4)%2 != 0) {
            var occupied = grid[y][x].length > 0;
            if(!occupied) {
                this.addRect(x + tileSize / 2, y + tileSize / 2, tileSize, tileSize);
                this.wait(); // Hover over the timeline to help debug!
            }
        }
    }
}

```

I hope this is helpful

---

<div class="post-metadata">

**Author:** ![nick](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/nick/32/784_2.png) [@nick](https://discourse.codecombat.com/u/nick)\
**Post date:** [January 8, 2014, 11:46pm UTC](https://discourse.codecombat.com/t/continue-seems-to-work-like-break/182/2 "2014-01-08T23:46:32Z")

</div>

Ah, I know what you mean: the continue stuff is getting mangled between JS\_WALA and traceur in our Aether transpiler. It sounds like it might be a bit hairy to fix: [https://github.com/google/traceur-compiler/issues/605](https://github.com/google/traceur-compiler/issues/605)

I’ll [start an issue in our GitHub](https://github.com/codecombat/aether/issues/7) to see if we can’t work around it a better way.
