For a given set of

symbols to be coded by a code of alphabet size

, the necessary and sufficient conditions for the optimality of a block code of length

, if

, and the optimality of a code of words of length only

and

, if

, are stated, and an example of the construction of such a code is given.