What is Range in Scala? How to create a Range in Scala?
Answer Posted / Budheshwar Singh
A 'Range' in Scala represents a sequence of integers from a start value, end value (exclusive), and with a step size. To create a range, use the 'to' method on an integer or the 'ranged' method on two integers: val range1 = 1 to 5; val range2 = 0 until 10. Ranges can also be constructed using three arguments with the syntax: val range3 = Range(start, end, step)
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers