Skip to content

Instantly share code, notes, and snippets.

@SergeyTLV
Last active October 1, 2020 16:35
Show Gist options
  • Save SergeyTLV/b0e248b429957fc18395824ac86eb762 to your computer and use it in GitHub Desktop.
Save SergeyTLV/b0e248b429957fc18395824ac86eb762 to your computer and use it in GitHub Desktop.
for in loop #loops
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)")
}
repeats at least once
//sample
repeat {
} while condition
//example
var repWhileCounter = 8
repeat {
print("repWhileCounter")
repWhileCounter -= 1
} while repWhileCounter > 0
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