Cooking an egg is when the whites are set, and the yolk is done to your preference. If you like a runny yolk, cook it for a shorter time. If you prefer a firm yolk, cook for a bit longer. You can also cover the pan with a lid to help speed up the cooking process.