This is a topic of debate. Some recipes advise you to cook the egg first and set it aside and add it back at the end, while others suggest you scramble the egg just before adding the rice or alongside the rice. In my view you should scramble the egg before mixing it into the rice to ensure you have nice definite pieces of scrambled egg as opposed to having egg that is well blended with the rice it disappears. You also want to avoid having cold and dry chunks of egg, which can be a risk when you add the egg first.