57 lines
873 B
Plaintext
57 lines
873 B
Plaintext
Brevity may be the soul of wit, but concise (yet readable!) code is the soul of good programming. For that reason, you should never use a ``++let++`` or ``++var++`` keyword that can be left out with the same effect.
|
|
|
|
|
|
== Noncompliant Code Example
|
|
|
|
[source,swift]
|
|
----
|
|
if let x = x, let y = y { // Noncompliant
|
|
// ...
|
|
}
|
|
|
|
if let p = p, var q = q {
|
|
// ...
|
|
}
|
|
|
|
if case (let x?, let y?) = foo { // Noncompliant
|
|
// ...
|
|
}
|
|
----
|
|
|
|
|
|
== Compliant Solution
|
|
|
|
[source,swift]
|
|
----
|
|
if let x = x, y = y {
|
|
// ...
|
|
}
|
|
|
|
if let p = p, var q = q {
|
|
// ...
|
|
}
|
|
|
|
if case (x?, y?) = foo {
|
|
// ...
|
|
}
|
|
----
|
|
|
|
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
include::message.adoc[]
|
|
|
|
include::highlighting.adoc[]
|
|
|
|
'''
|
|
== Comments And Links
|
|
(visible only on this page)
|
|
|
|
include::comments-and-links.adoc[]
|
|
endif::env-github,rspecator-view[]
|