Recap - Reversed Array
Part of the Fundamentals section of Coddy's GDScript journey. Lesson 67 of 92.
Challenge
EasyThe 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
4Operators Part 1
Arithmetic OperatorsInteger DivisionModulo OperatorArithmetic ShortcutsRecap - Simple MathComparison Operators10Functions
Declare a FunctionArgumentsReturnReturn TypesRecap - Sigma FunctionRecap - Validation FunctionDefault Values5Operators Part 2
Logical Operators Part 1Logical Operators Part 2Recap - Simple LogicLogical Operators Part 3Ternary OperatorPractice on your own: Online GDScript compiler