LED's doesn't light up with digital output

That code doesn't compile so that's why it doesn't work.

Anyway why is pin 2 set to output and then immediately changed to input?

Steve