What is meant by inferring latches, how to avoid it?
Consider the following:
always @(s1 or s0 or i0 or i1 or i2 or i3)
case ({s1, s0})
2'd0: out = i0;
2'd1: out = i1;
2'd2: out = i2;
endcase
In a case statement if all possible combinations aren't compared and default is also not specified like in instance above a latch will be inferred, a latch is inferred since to reproduce the previous value when unknown branch is specified.
For illustration in above case if {s1, s0}=3, the previous stored value is reproduced for this storing a latch is inferred.
The same may be observed in IF statement in case an ELSE IF is not specified.
To avoid inferring latches make sure that all cases are mentioned if not default condition is provided.