Arity
Sometimes an argument might accept more than one value. This is especially a case when a data member is an array or associative array. In this case argparse supports two ways of specifying multiple values for an argument:
- --arg value1 value2 ...
- --arg=value1,value2,...
argparse supports these use cases for arity:
- Exact number of values. 
- Limited range of minimum-maximum number of values. 
- Unlimited range where only minimum number of values is provided (e.g. argument accepts any number of values). 
To adjust the arity, use one the following API:
- NumberOfValues(size_t min, size_t max)– sets both minimum and maximum number of values.
- NumberOfValues(size_t num)– sets the exact number of values.
- MinNumberOfValues(size_t min)– sets minimum number of values.
- MaxNumberOfValues(size_t max)– sets maximum number of values.
Example:
Default arity
| Type | Default arity | Notes | 
|---|---|---|
| 
 | 0 | Boolean flags do not accept values with the only exception when they are specified in  | 
| String or scalar | 1 | Exactly one value is accepted. | 
| Static array | Length of array | If a range is desired then use provided API to adjust arity. | 
| Dynamic array | 1 ... ∞ | |
| Associative array | 1 ... ∞ | |
| 
 | 0 | Same as boolean flag. | 
| 
 | 1 | Same as  | 
| 
 | 1 ... ∞ | Same as  | 
| 
 | 1 ... ∞ | Same as  | 
Named arguments with no values
Sometimes named arguments can have no values in command line. Here are two cases that arise in this situation:
- If value is optional and argument should get specific value in this case then use - AllowNoValue.
- If argument must not have any value in command line then use - ForceNoValuein this case.
Both AllowNoValue and ForceNoValue accept a value that should be used when no value is provided in the command line. The difference between them can be seen in this example: