New to Arduino, need some help

Here's what I'm trying to do. I want to have an output every other time I put input in. This is what I've come up with. I know there's a problem somewhere, I just don't know where. Any ideas??

int LEDpin = 5;
int switchPin = 13;
bool flag = 1;

void setup()
{
pinMode(5, OUTPUT);
pinMode(13, INPUT);
Serial.begin(9600);

}

void loop()
{
Serial.print(flag);
Serial.print(LEDpin);
{
if (flag == 1);
digitalWrite(LEDpin, HIGH);

}
{
if (flag == 0)
digitalWrite(LEDpin, LOW);
}

{
if (digitalRead(13) == HIGH && (flag == 1));
flag=0;

if (digitalRead(13) == HIGH && (flag == 0));
flag=1;

}
}

Serial.print(LEDpin);

You know that LEDpin = 5, why print it over and over? Or maybe you want the state of the pin? The digitalRead() function will return the state of a pin.

if (flag == 1);

Ending an if statement with a semicolon is not proper syntax. The statement after the if will be executed unconditionally.

So what does the code actually do? How does that differ from what you want?

Read the how to use this forum-please read stickies to see how to propely post code.

I want to have an output every other time I put input in.

Use a state change detector, There is an example in the Arduino IDE under the file menu:-
File -> Examples -> 02.Digital -> StateChangeDetetion

Use that to count the number of time the input changes. Then use the least significant bit of that count to determine if this is an odd or even number. You can isolate this bit by doing a bitwise AND operation &

if(count & 1) { // do this if count is odd
// this
}
else { // do that if count is even
// that
}

Thanks, I’ll give those a shot and see if I can make some headway.

if (digitalRead(13) == HIGH && (flag == 1));

The semicolon should not be there. It is the only code dependent on the test. The following line will be executed unconditionally