Imagine the range of numbers, we don't calculate them

Report a typo

Check the range constructor method in LazyList and complete the following function, ensuring that the arguments are valid. The function must return a list of all numbers from start to end. The list should not be calculated immediately.

Sample Input 1:

2
5

Sample Output 1:

2
3
4
Write a program in Scala 3
def safeRange(start: Int, end: Int): LazyList[Int] =
if (start >= end) LazyList.empty
else LazyList.???
___

Create a free account to access the full topic