Logo

Programming-Idioms

History of Idiom 171 > diff from v11 to v12

Edit summary for version 12 by bikemowman:
[Ruby] It's more idiomatic in Ruby to use << than push.

Version 11

2019-09-26, 14:14:21

Version 12

2019-09-26, 14:21:57

Idiom #171 Add an element at the end of a list

Append element x to the list s.

Idiom #171 Add an element at the end of a list

Append element x to the list s.

Extra Keywords
push grow
Extra Keywords
push grow
Code
s.push(x)
Code
s << x
Doc URL
https://ruby-doc.org/core-2.6.4/Array.html#method-i-3C-3C