28 lines
717 B
Plaintext

A ``++for++`` loop with a stop condition that can never be reached, such as one with a counter that moves in the wrong direction, will run infinitely. While there are occasions when an infinite loop is intended, the convention is to construct such loops as ``++while++`` loops. More typically, an infinite ``++for++`` loop is a bug.
== Noncompliant Code Example
----
for (var i = 0; i < strings.length; i--) { // Noncompliant;
//...
}
----
== Compliant Solution
----
for (var i = 0; i < strings.length; i++) {
//...
}
----
include::../see.adoc[]
ifdef::env-github,rspecator-view[]
'''
== Comments And Links
(visible only on this page)
include::comments-and-links.adoc[]
endif::env-github,rspecator-view[]