How can unwanted latches be avoided?

In this source code, Y is assigned to in only one of the two branches of the if statement         
in an unclocked process, whereas Z is assigned to in both branches.  By omitting
the assignment to Y in both branches, memory is inferred, and a latch is synthesized. 





By making an assignment to Y in both branches of the if statement in the unclocked process        
in the source code, no memory is inferred, and no latch is synthesized.





For signals assigned to in an unclocked process, it is necessary to assign to them in all
branches of if and case statements to avoid unwanted latches.  For signals assigned to
in a clocked process, it is not necessary to assign to them in all branches of if and case
statements.