I recently had an app I wanted to make and started studying swift, and the teaching materials explained the following about operators.
I've been working for about 4 years and experienced various languages, but honestly I was surprised because I had never used or heard of it. ~~ Just lack of knowledge ~~
It seems that swift is used like this ↓
sample.swift
var total = 0
for count in 0...5 {
total += count
}
print(total)
As the name suggests, it is an operator that indicates a range.
In this case, 0 to 5 are added and displayed.
When I looked it up, swift couldn't write java or objective-c-like for statements from swift3.0, so I'd like to see it unless I write it with for-in
.
Reference article
You have to be able to use it ... ~~ (← range operator) ~~
Recommended Posts