20 lines
362 B
Plaintext
20 lines
362 B
Plaintext
![]() |
include::../description.adoc[]
|
||
|
|
||
|
== Noncompliant Code Example
|
||
|
|
||
|
----
|
||
|
var target, num = -5, 3
|
||
|
|
||
|
target =- num // Noncompliant; target = -3. Is that really what's meant?
|
||
|
target =+ num // Noncompliant; target = 3
|
||
|
----
|
||
|
|
||
|
== Compliant Solution
|
||
|
|
||
|
----
|
||
|
var target, num = -5, 3
|
||
|
|
||
|
target = -num // Compliant; intent to assign inverse value of num is clear
|
||
|
target += num
|
||
|
----
|