validationlanguage-agnosticnumbers

Better name for "non-negative" value?


I'm validating that the integer is zero or greater. To describe the requirement as "zero or greater" feels too verbose. To say "non-negative" introduces negative language, which I try to avoid when I can.

What concise descriptor do you use when describing a value that must be zero or greater?


Solution

  • I would argue that the answer depends on what audience you are writing for. If this is for other developers (i.e. for variable naming or API docs), then I think "non-negative" would most precisely express what you want. If this is for end-user documentation, then "positive" will be fine.

    Always consider your audience, even while programming.