...

>

Alternative Syntax

Alternative Syntax

Gather some alternative syntax that can be used for strings and arrays!

You have, so far, learned that Strings are defined using single or double quotes, like so:

Ruby
"A String"
'Another String'

And Arrays are defined using square brackets, with a comma-separated list of objects, like so:

Ruby
["One", "Two", "Three"]

We’d like to quickly mention two alternative syntaxes for defining the same objects, even though they’re not used very often. However, you may sometimes find them in other people’s code, so it’s useful to know they exist.

Strings

First, Ruby has an alternative ...

Create a free account to access the full course.

By signing up, you agree to Educative's Terms of Service and Privacy Policy