Gamemaker Studio 2 Gml -

inventory = ["sword", "shield", "potion"]; array_push(inventory, "bow"); // Add item var last_item = inventory[array_length(inventory) - 1];