The to(end: Char) method is utilized to return a range from the stated character to the ‘end’, which is given in the arguments list but here “step” is not specified in the arguments list.
Method Definition: def to(end: Char): Inclusive[Char]
Return Type: It returns the range.
Example: 1#
// Scala program of to() // method // Creating object object GfG { // Main method def main(args:Array[String]) { // Applying to() method val result = 'A'.to('G') // Displays output println(result) } } |
chevron_right
filter_none
Output:
NumericRange(A, B, C, D, E, F, G)
Example: 2#
// Scala program of to() // method // Creating object object GfG { // Main method def main(args:Array[String]) { // Applying to() method val result = ('0').to('9') // Displays output println(result) } } |
chevron_right
filter_none
Output:
NumericRange(0, 1, 2, 3, 4, 5, 6, 7, 8, 9)
Recommended Posts:
- Scala Char to(end: Char, step: Char) method with example
- Scala Char |(x: Char) method with example
- Scala Char ^(x: Char) method with example
- Scala Char >=(x: Char) method with example
- Scala Char >(x: Char) method with example
- Scala Char ==(x: Char) method with example
- Scala Char <=(x: Char) method with example
- Scala Char !=(x: Char) method with example
- Scala Char %(x: Char) method with example
- Scala Char &(x: Char) method with example
- Scala Char *(x: Char) method with example
- Scala Char <(x: Char) method with example
- Scala Char /(x: Char) method with example
- Scala Char -(x: Char) method with example
- Scala Char +(x: Char) method with example
- Scala Int <(x: Char) method with example
- Scala Char isDigit() method with example
- Scala Char isLetter() method with example
- Scala Char isLetterOrDigit() method with example
- Scala Char toDouble() method with example
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

