Ruby Array : Push and Pop
Push
chars = ["a", "b", "c"] => ["a", "b", "c"] chars.push "d" => ["a", "b", "c", "d"] chars.push "e" => ["a", "b", "c", "d", "e"]
Pop : Last In First Out (LIFO)
chars => ["a", "b", "c", "d", "e"] chars.pop => "e" chars.pop => "d"
Comments
Post a Comment