Once you learn that
shift/unshift
are likepush/pop
on the other end of the array, you can mentally drop the ‘f’ from the name of the methods to remember which one ‘dumps’ elements and which one ‘inserts’ them. :)
Source: What Does Ruby’s Array#shift do? – Stack Overflow [WayBack]
Via: Originally shared by This is why I Code
Need a good memory hook to remember what shift and unshift do in programming languages like Ruby or Perl? Jeroen Wiert Pluimers – Google+
https://stackoverflow.com/questions/3718625/what-does-rubys-arrayshift-do
https://stackoverflow.com/questions/3718625/what-does-rubys-arrayshift-do