The main function of the cell nucleus is to regulate gene expression. It is the nucleus' function to control which parts of the DNA (which is stored in the nucleus) is transcribed, expressed/produced as products (e.g. proteins), and how much of the products are produced.
This regulation is important because it allows the body to adapt to changes in the environment by adjusting the amounts of proteins which maintain the homeostatic (or metabolic) balance in the body.
Gene expression can be regulated in several different ways. Generally, the points where a gene or the expression of a gene can be modified are during or after the various steps of gene expression, such as during transcription, post-transcription, translation, or post-translation.
The most important function of the nucleus is to house and protect DNA, which is the blue-print for all of the cells functions. The nuclear membrane is highly selective about what types of molecules are allowed in and out of the nucleus. RNA plays a key factor in protecting the DNA molecule because RNA is an messenger that copy of the DNA molecules. These RNA molecules are then transported to the ribosome and translated into proteins. DNA is a very precious molecules. Without it, the cell is unable to function.