Menu
CoddyTech

Recap - Reversed Array

Part of the Fundamentals section of Coddy's GDScript journey. Lesson 67 of 92.

challenge icon

Challenge

Easy

The program reads a count, then that many whole numbers, one per line, into the array numbers. This part is already written.

Build a new array with the same numbers in reverse order and print it. For 1, 2, 3, the output is:

[3, 2, 1]

Do not use the reverse() method: build the new array with a loop and append().

Try it yourself

extends Node

func _ready():
	var count := int(OS.read_string_from_stdin())
	var numbers := []
	for i in range(count):
		numbers.append(int(OS.read_string_from_stdin()))
	# Write your code below

All lessons in Fundamentals

Practice on your own: Online GDScript compiler