1
0
mirror of https://github.com/adambard/learnxinyminutes-docs.git synced 2025-08-01 12:30:48 +02:00

include %w option

This commit is contained in:
Claudio Secco
2020-05-02 13:03:36 -03:00
parent f21a011eb4
commit a67f4663eb

View File

@@ -181,6 +181,9 @@ array = [1, 2, 3, 4, 5] #=> [1, 2, 3, 4, 5]
# Arrays can contain different types of items.
[1, 'hello', false] #=> [1, "hello", false]
# You might prefer %w instead of quotes
%w[foo bar baz] #=> ["foo", "bar", "baz"]
# Arrays can be indexed.
# From the front...
array[0] #=> 1