mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2025-04-27 07:33:57 +00:00
include %w option
This commit is contained in:
parent
f21a011eb4
commit
a67f4663eb
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user