9
10function main() {
11 x = 600851475143;
12 while (true) {13 y = smallestFactor(x);
14 if (y < x) {
15 x /= y;
A constant expression such as a literal when used as a condition in an if
/ for
/ while
or do...while
statement can cause errors in a production environment.
Usage of such constructs in a development environment for debugging triggers is common, but it's not a good practice to push them to VCS.
if (false) {
doSomethingUnfinished();
}
if (void x) {
doSomethingUnfinished();
}
for (;-2;) {
doSomethingForever();
}
while (typeof x) {
doSomethingForever();
}
do {
doSomethingForever();
} while (x = -1);
const result = 0 ? a : b;
if (foo()) {
doSomethingUnfinished();
}
for (let i = 0; i < foo; ++i) {
doSomethingForever();
}
while (true) {
doSomethingForever();
}
do {
doSomethingForever();
} while (x == -1);
const result = cond() ? a : b;