Last active
October 1, 2020 16:35
-
-
Save SergeyTLV/b0e248b429957fc18395824ac86eb762 to your computer and use it in GitHub Desktop.
for in loop #loops
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for variable in lower...upper { | |
} | |
for counter in 0..<myArray.count { | |
myArray[counter] = "Buy " + myArray[counter] | |
print (myArray[counter]) | |
for item in myArray { | |
print("kupi " + item) | |
} | |
for x in 1...5 { | |
print("Index: \(x)") | |
} | |
for z in 1..<5 { | |
print("Index Z: \(z)") | |
} | |
for i in 0..<salaries.count { | |
salaries[i] = salaries[i] + (salaries[i] * 0.10) | |
} | |
for salary in salaries { | |
print("Salary: \(salary)") | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
repeats at least once | |
//sample | |
repeat { | |
} while condition | |
//example | |
var repWhileCounter = 8 | |
repeat { | |
print("repWhileCounter") | |
repWhileCounter -= 1 | |
} while repWhileCounter > 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
while condition { | |
} | |
//example | |
var wCounter = 7 | |
while wCounter > 0 { | |
print ("hello") | |
wCounter -= 1 | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment