Fred Tingaud 16f6c0aecf
Inline adoc when include has no additional value (#1940)
Inline adoc files when they are included exactly once.

Also fix language tags because this inlining gives us better information
on what language the code is written in.
2023-05-25 14:18:12 +02:00

42 lines
1.1 KiB
Plaintext

== Why is this an issue?
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
[source,javascript]
----
for (var i = 0; i < strings.length; i--) { // Noncompliant;
//...
}
----
=== Compliant solution
[source,javascript]
----
for (var i = 0; i < strings.length; i++) {
//...
}
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::../message.adoc[]
'''
== Comments And Links
(visible only on this page)
=== on 13 Mar 2015, 14:03:09 Pierre-Yves Nicolas wrote:
In JavaScript, moving the counter in the wrong direction causes an infinite loop because there is no integer type. All numbers are 64 bit floating point numbers.
include::../comments-and-links.adoc[]
endif::env-github,rspecator-view[]