Skip to content

Conversation

Wessel-Boers
Copy link

Array#append is more idiomatic in modern Ruby (post-2.5) for its clarity and descriptive name, although Array#push is still frequently used due to its long history and prevalence in older codebases.

It would be a good practice for Ruby beginners to use append for new code.

Also, this would more intuitively help them remember Array#prepend for adding to the start of an array (as opposed to Array#unshift)

  • [x ] I solemnly swear that this is all original content of which I am the original author
  • Pull request title is prepended with [language/lang-code] (example [python/fr] for Python in French or [java] for multiple Java translations)
  • [ x] Pull request touches only one file (or a set of logically related files with similar changes made)
  • Content changes are aimed at intermediate to experienced programmers (this is a poor format for explaining fundamental programming concepts)
  • If you've changed any part of the YAML Frontmatter, make sure it is formatted according to CONTRIBUTING.md

Array#append is more idiomatic in modern Ruby (post-2.5) for its clarity and descriptive name, although Array#push is still frequently used due to its long history and prevalence in older codebases. 

It would be a good practice for Ruby beginners to use append for new code. 

Also, this would more intuitively help them remember Array#prepend for adding to the start of an array (as opposed to Array#unshift)
@Wessel-Boers Wessel-Boers changed the title Update ruby.md by adding array method [ruby/en] Update ruby.md by adding array method Aug 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant