Two of the most common replies apply to you question.
-
Use code tags when posting code!
-
See blink without delay (examples) then look in the playground.
The other topic you need to look at is the Finite State Machine, again its in the playground.
Mark