52 lines
964 B
Plaintext
52 lines
964 B
Plaintext
== Why is this an issue?
|
|
|
|
include::../description.adoc[]
|
|
|
|
=== Noncompliant code example
|
|
|
|
[source,swift]
|
|
----
|
|
if someCondition { doSomething()}
|
|
...
|
|
var result = doSomething(); return result
|
|
----
|
|
|
|
=== Compliant solution
|
|
|
|
[source,swift]
|
|
----
|
|
if someCondition {
|
|
doSomething()
|
|
}
|
|
...
|
|
var result = doSomething()
|
|
return result
|
|
----
|
|
|
|
=== Exceptions
|
|
|
|
Variable declaration with initialising code block and closure expressions containing a single statement are ignored.
|
|
|
|
|
|
----
|
|
var x : Int { return 0 } // Variable declaration with initialising code block
|
|
doSomething({ (x: Int, y: Int) -> Bool in return x > y }, 5) // Closure expression
|
|
----
|
|
|
|
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[]
|