'characters is unavailable' please use string directly
问题 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. 回答1: Your code should work as it is if you delete the characters I suggest