swift - syntax, == operator when not in if statement. -
i came across line of code
let shouldexpandwindow = self.itemsoffset + self.items.count == self.windowoffset + self.windowcount
i'm not used seeing ==
outside of if statement. know it's meant comparisons. how work in case. thank
==
function takes 2 values of same type (such int
) , returns bool
. example, if comparing 2 int
s, function signature is:
func ==(lhs: int, rhs: int) -> bool
the result of comparison assigned shouldexpandwindow
swift infers have type bool
.
you can find out option-clicking on ==
:
Comments
Post a Comment