If you post a code snippet, ALWAYS USE CODE TAGS:
How to use code tags: Using code tags properly
How to report your problem productively in the Unity3D forums:
http://plbm.com/?p=220
How to understand errors in general:
For something as complicated as a day/night cycle, probably best to start with tutorials. There are PLENTY: