Arduino Nano V3 only runs sketch correctly after hitting reset or starting serial monitor

Will google what that is, so far i know if statements and whiles and some other conditions.

I wanted the while because i wanted to time the loop.