Post

Replies

Boosts

Views

Activity

Reply to Need help Exercise Partial Iteration (Swift playground)
I tried it like this: var index: Int = 0 var foundMessage: Bool = false while foundMessage == false {     foundMessage = aliceMessages[index].contains("Caterpillar")     index += 1     if foundMessage {         print()     } } print(index - 1) But I don't think that it should look like this. Also it should've been written with while loop, so it cannot be done by for in with break.
Topic: Programming Languages SubTopic: Swift Tags:
Sep ’22
Reply to Need help Exercise Partial Iteration (Swift playground)
I tried it like this: var index: Int = 0 var foundMessage: Bool = false while foundMessage == false {     foundMessage = aliceMessages[index].contains("Caterpillar")     index += 1     if foundMessage {         print()     } } print(index - 1) But I don't think that it should look like this. Also it should've been written with while loop, so it cannot be done by for in with break.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Sep ’22