I can't figure out how to fix it. I just want to understand how it works and what should be replaced.
I've already tried to delete characters., but it still doesn't work.
import Foundation
var shrinking = String("hello")
repeat {
print(shrinking)
shrinking = String(shrinking.characters.dropLast())
}
while shrinking.characters.count > 0
I expected the program to output:
hello
hell
hel
he
h
but it doesn't work at all.