mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2025-08-04 05:47:53 +02:00
include %w option
This commit is contained in:
@@ -181,6 +181,9 @@ array = [1, 2, 3, 4, 5] #=> [1, 2, 3, 4, 5]
|
|||||||
# Arrays can contain different types of items.
|
# Arrays can contain different types of items.
|
||||||
[1, 'hello', false] #=> [1, "hello", false]
|
[1, 'hello', false] #=> [1, "hello", false]
|
||||||
|
|
||||||
|
# You might prefer %w instead of quotes
|
||||||
|
%w[foo bar baz] #=> ["foo", "bar", "baz"]
|
||||||
|
|
||||||
# Arrays can be indexed.
|
# Arrays can be indexed.
|
||||||
# From the front...
|
# From the front...
|
||||||
array[0] #=> 1
|
array[0] #=> 1
|
||||||
|
Reference in New Issue
Block a user