ELI5: Explain Like I'm 5

Range (computer science)

Range in computer science refers to the collection of numbers that a function can output. Imagine you have a special machine that takes in a number (let's call it X) and does something to it, like add 3 or multiply it by 2. The range of this machine is the set of all possible answers it can give you after doing the operation.

For example, if you put a 2 into the machine that doubles numbers, the range of this machine would be {4}, because the only possible output is 4.

But if you put a 4 into the machine that adds 3 to numbers, the range of this machine would be {7}, because the only possible output is 7.

It's important to understand the range because it tells you what results you can expect from a function. If you know the range of a function, you can make predictions about what will happen when you put different numbers into it.
Related topics others have asked about: