What is the difference between two stride function?
stride(from:to:by)
& (from:through:by)
While go through the tutorial, Control flow with stride i found that two types of stride function as per my knowledge both working like a same, i don't know what is the difference between them hence anyone can explain?
Use the stride(from:to:by:)
let minutes = 60
let minuteInterval = 5
for tickMark in stride(from: 0, to: minutes, by: minuteInterval) {
// render the tick mark every 5 minutes (0, 5, 10, 15 ... 45, 50, 55)
}
Using stride(from:through:by:) instead:
let hours = 12
let hourInterval = 3
for tickMark in stride(from: 3, through: hours, by: hourInterval) {
// render the tick mark every 3 hours (3, 6, 9, 12)
}