For In Loop in Swift - Tutorial for Beginners (HOW TO)

preview_player
Показать описание
Let's learn how for in loops work in Swift 5 and Xcode 11. For In loops are powerful loops you can use in your iOS app to iterate over large collections of data and get each item. They allow you to reduce the amount of code you need to write to accomplish certain tasks. For in loops execute in linear time but nevertheless are powerful.

Let's learn through examples!
Рекомендации по теме
Комментарии
Автор

Thank you for such a good way of explanation

dishavanani
Автор

Great video, but it would help to
Print out the functions so that we know what’s going to execute once you’ve created the something that they’re going to do if that makes any sense

wensmusic
Автор

I’m new to swift. I just have a quick question. NOT in playground, but in an actual project, I added an array and a button. I wanted to make something where if I press the button, it prints all the numbers from the array. Here was my code.
Button code:
1. Let numberarray = [1, 2, 3, 4, 5, 6, 7, 8]
2. For thing in numberarray {
3. numberlabel.text = “/(thing)”
}
(Btw numberlabel was the name of my label)
When I pressed run, it only printed “8” on the numberlabel. Why did it not print all 8 of the numbers? I know this might be a stupid question. I’m new to swift. It only printed the number “8” instead of all the 8 numbers.

hanzalamemon
Автор

you are too fast for beginner. Explanation is good.

SachaRahgir
visit shbcf.ru