Subscript operator (x[y])

Returns the element at the specified position in the string.

Usage:

x[y]
-> Returns the y th element from string or array x.
x[y to z]
-> Returns the y to z range from String.

Returns:

Depends on the usage (see above).

Examples:

"abc"[2]
-> Returns "b".
This application uses cookies to allow login. By continuing to use this application, you agree to the use of cookies.


Help - Subscript (Crystal Syntax)

Loading application