Limiting multiple value fields?

For fields that allow multiple values, is there a way to limit the amount of of values allowed instead of unlimited? How would you do that, if so?