I am trying to get better with recursion, and one excercise I came upon was to revert a string. At first I was trying to solve this by any means possible, and my first code had ~50 lines. Step by step, improving it , and reading all the Google, I ended up with this:
if input == "":
return input[-1] + three(input.resize(len(input) - 1))
The only problem is - there's no resize function with strings. Alternatively, I've seen solutions doing "return everything but the last symbol".
Here's the best explanation: https://stackoverflow.com/questions/5532902/python-reversing-a-string-using-recursion
This is guy's code:
if text == "":
return text[-1] + backward(text[:-1])
(Resembles something, huh?))
But. There's no "call everything but the last symbol" function/syntaxis in GDSript.
Or is there? Please, help.