# 配列の最後の値を取り出す(Array.pop) > 配列から最後の要素を削除し、その値を返します。 - カテゴリ:配列(arrays) - ブロック:配列 から最後の値を削除して返す - URL:https://makecode.minecraft-okinawa.com/reference/arrays/pop/ - 公式データ取得日:2026-11-13 - 動作確認:確認待ち ## JavaScript ```javascript ["hello"].pop() ``` ## Python ```python ["hello"].pop() ``` ## 使用例 ### If you have an array with 4 numbers, like 1, 2, 3, and 4, you remove the last number from the array by popping it off of the end. To pop the number from the array in blocks, do this: ```javascript let thoseNumbers = [1, 2, 3, 4]; let lastNumber = thoseNumbers.pop(); ``` ```python thoseNumbers = [1, 2, 3, 4] lastNumber = thoseNumbers.pop() ``` ### Clean out your junk drawer but check if the scissors are in there. Do this by removing them from your list items in the drawer. ```javascript let found = false; let junk = ["paper clip", "pencil", "notepad", "glue", "scissors", "screw driver"]; while (junk.length > 0) { if (junk.pop() == "scissors") { found = true; } } ``` ```python found = False junk = ["paper clip", "pencil", "notepad", "glue", "scissors", "screw driver"] while len(junk) > 0: if junk.pop() == "scissors": found = True ``` ## 出典 - [MakeCode for Minecraft 公式リファレンス(Array.pop)](https://minecraft.makecode.com/reference/arrays/pop) 執筆:鈴木孝昌(現役プロジェクトマネージャー/マイクラカップ指導者)/運営:沖縄マイクラ部 プログラミングスクール「クロスウェーブ」(https://minecraft-okinawa.com/)