Yes, if you change from the default mode. The easiest solution is to use:
SYSTEM_THREAD(ENABLED);
which allows your code to run even when there is no cloud connectivity. There are a few caveats, most importantly you should avoid calling Particle.publish when not cloud connected to avoid blocking for several minutes in certain cases.