2020-06-30 10:16:44 +02:00
include::../description.adoc[]
== Noncompliant Code Example
----
func compute(a int, b int) {
sum := a + b
if sum > 0 { } // Noncompliant; empty on purpose or missing piece of code?
fmt.Println("Result:", sum)
}
----
== Compliant Solution
----
func compute(a int, b int) {
sum := a + b
if sum > 0 {
fmt.Println("Positive result")
}
fmt.Println("Result:", sum)
}
----
== Exceptions
2021-01-27 13:42:22 +01:00
When a block contains a comment, this block is not considered to be empty. ``++for++`` without ``++init++`` and ``++post++`` statements with empty blocks are ignored as well.
2021-06-02 20:44:38 +02:00
2021-06-03 09:05:38 +02:00
ifdef::env-github,rspecator-view[]
2021-06-02 20:44:38 +02:00
== Comments And Links
(visible only on this page)
include::../comments-and-links.adoc[]
2021-06-03 09:05:38 +02:00
endif::env-github,rspecator-view[]