CHALLENGE 2: Iterating an Array With Position Numbers ==================================================================== TASK ---- Build an Array of five enemy names as Strings. Using a for loop, print each name along with its position in the array (e.g. "1: Slime"). SOLUTION CODE ------------- extends Node2D func _ready() -> void: var enemy_names: Array[String] = ["Slime", "Goblin", "Bat", "Skeleton", "Dragon"] for i in range(enemy_names.size()): print(str(i + 1) + ": " + enemy_names[i]) OUTPUT ------ 1: Slime 2: Goblin 3: Bat 4: Skeleton 5: Dragon WHY THIS WORKS AS AN ANSWER ---------------------------- Array[String] is a typed array - every element is guaranteed to be a String, which is a good habit once a list's contents are known in advance, the same way you might reach for a typed list/List[str] in Python once type hints matter to you. range(enemy_names.size()) produces 0, 1, 2, 3, 4 - one index per element - so enemy_names[i] can be used to look up the name at that position while i itself gives the position number. Adding 1 to i before printing converts from a 0-based index to the 1-based numbering the task actually asked for ("1: Slime", not "0: Slime"). str(i + 1) converts the number to a String so it can be joined with the "+" operator, since GDScript (like Python) won't silently combine a number and a String with "+" the way some looser languages do. An alternative using enemy_names.size() directly with a while loop, or GDScript's own index-aware "for i in enemy_names.size()" shorthand (range() is optional here, since GDScript accepts an integer directly as the iterable), would work identically.