I would like to use the fact that Vec.last()
returns a None
if there is nothing at that index but that index still exists. The problem is that I can't find a way to compare the result to anything inside of a while
or if
. I can however compare it if I use match
, although that seems less efficient than using a while
loop. Is there a way to compare it in an if
or a while
loop?
This is what I'm trying to do, but the self.particles.last() == None
is invalid since you can't compare things to None
except None
as far as I can tell.
while vec.last() == None {
num += 1;
}