expected unqualified-id before 'while'

I’ve been looking over and over the code and can’t see anything wrong but there has got to be. I would appreciate if someone could help me out here. I’m just trying a simple repeating loop. The code is below.
Thanks in advance.

===============================================

/*
Blink

Turns on an LED on for one second, then off for one second, repeatedly.

The circuit:

  • LED connected from digital pin 13 to ground.

  • Note: On most Arduino boards, there is already an LED on the board
    connected to pin 13, so you don’t need any extra components for this example.

Created 1 June 2005
By David C
based on an orginal by H. Barragan for the Wiring i/o board

*/

int ledPin = 13; // LED connected to digital pin 13
unsigned long time; //

// The setup() method runs once, when the sketch starts

void setup() {
// initialize the digital pin as an output:
pinMode(ledPin, OUTPUT);
Serial.begin(9600);

}

// the loop() method runs over and over again,
// as long as the Arduino has power

while (time <= 50) {
digitalWrite(ledPin, HIGH);
delay(time);
digitalWrite(ledPin, LOW);
delay(time);
if (time < 49) ;
{
time++;
}
else;
{
time = 0;
}
}

=============================================

You need the void loop() { } construct around the while () construct.

Hi,

you’re missing the “void loop()” function. Try the following code:

// the loop() method runs over and over again,
// as long as the Arduino has power

void loop() {
while (time <= 50) {
digitalWrite(ledPin, HIGH);
delay(time);
digitalWrite(ledPin, LOW);
delay(time);
if (time < 49) ;
{
time++;
}
else;
{
time = 0;
}
}
}

if (time < 49) ;

Lose the semicolon (and please use the Code (#) button when posting code)

The void loop and loosing the semi worked like a charm, at least I can compile it, thanks a lot. :)