You can have constexpr functions that compute things, but they must be composed completely of other constexprs.
constexpr int factorial( int n ) {
return n == 0 ? 1 : n * factorial(n-1);
}
The usefulness of constexprs over typical const variables is mostly useful in combination with templates, where template parameters must be known at compile time: any constexpr can be computed by the compiler, and so can be used as a template argument.