  We establish a general formula for the maximum size of finite length block
codes with minimum pairwise distance no less than $d$. The achievability
argument involves an iterative construction of a set of radius-$d$ balls, each
centered at a codeword. We demonstrate that the number of such balls that cover
the entire code alphabet cannot exceed this maximum size. Our approach can be
applied to codes $i)$ with elements over arbitrary code alphabets, and $ii)$
under a broad class of distance measures, thereby ensuring the generality of
our formula. Our formula indicates that the maximum code size can be fully
characterized by the cumulative distribution function of the distance measure
evaluated at two independent and identically distributed random codewords. When
the two random codewords assume a uniform distribution over the entire code
alphabet, our formula recovers and obtains a natural generalization of the
Gilbert-Varshamov (GV) lower bound. We also establish a general formula for the
zero-error capacity of any sequence of channels. Finally, we extend our study
to the asymptotic setting, where we establish first- and second-order bounds on
the asymptotic code rate subject to a normalized minimum distance constraint.
