Data Constraints
4.1.5. Data Constraints#
In addition to representing data with different data storage methods, computers can also let you add additional constraints on what can be saved. So, for example, you might limit the length of a tweet to 280 characters, even though the computer can store longer strings.
There are many places these constraints might be used such as:
for an age (integer), only allow ages between 0 and 120
for a country name (string), have a pre-set list of valid country names
for a legal name (string), disallow emojis