Ruby - String Operations
Identify the error in this Ruby code snippet:
str = "example" puts str[2..5, 2]
str = "example" puts str[2..5, 2]
str[2..5, 2] which mixes range and length parameters incorrectly. Ruby does not support this syntax.str[2..5] for range or str[2, 2] for start and length. Mixing both causes a syntax error.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions