This is not object (literal) notation, it is defining a label
.
A label
can be used to give a looping construct a name. The benefits of doing this is that you can create more powerful breaks;
or continues;
by referencing outer loops (by their labels).
Note that how the structure of the program you referenced is a:
search: while () {
for (;;;) {
}
}
... and the author is using continue search;
inside the for
loop to continue the execution of the while loop.
As for what's happening on line 18, if (n % i == 0)
is using the modulo (%
) operator to get the remainder between dividing n / i
, and checking whether it's 0.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…