In the case where the domain of the function is the empty set {}, there is only one function with that domain (given any codomain), the empty function, and any formula can be used to define the empty function, since the formula won't apply to anything and will therefore never be wrong.

This includes a constant formula c; but the range of the empty function is not {c} but instead {}.

Most authors will not care, when defining the term "constant function" precisely, whether or not the empty function qualifies, and will use whatever definition is most convenient.

Sometimes, however, it is best not to consider the empty function to be constant, and a definition that makes reference to the range is preferable in those situations.

(This is much along the same lines of not considering an empty topological space to be connected, or not considering the trivial group to be simple.)