The to(end: int, step: int) method is utilized to return a range from the stated integer to the ‘end’, which is given in the arguments list and some step is also specified in the arguments list.
Method Definition: def to(end: Int, step: Int): Inclusive
Return Type: It returns the range.
Range(5, 7, 9)
Range(0, 3, 6, 9)
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.