I believe the compiler on this level is broken. I have created code similar to what the video displays, and the compiler kept giving me the issue, “expected an identifier and instead saw if.” I see no problem with the code I have. After my first attempt I decided to use the videos help code. And i’m still receiving the same compiler error,“expected an identifier and instead saw if.” Here is my code // Use different colored flags to perform different tasks.
loop {
var flagGreen = this.findFlag(“green”);
var flagBlack = this.findFlag(“black”);
// If there's a flagGreen...
-if flagGreen:
greenPos = flagGreen.pos;
greenX = greenPos.x;
greenY = greenPos.y;
self.this.buildXY("fence", greenX, greenY);
// Build a fence at flagGreen's position.
this.buildXY("fence", 36, 30);
// Pick up the flag!
this.pickUpFlag(flagGreen);
// If there's a flagBlack...
if (flagBlack) {
blackPos = flagBlack.pos;
blackX = blackPos.x;
blackY = blackPos.y;
// Build a fire-trap at flagBlack's position.
this.buildXY("fire-trap",blackX, blackY);
// Pick up the flag!
this.pickUpFlag(flagBlack);
// Move back to the center.
this.moveXY(43, 31);
}
}