I cannot figure how the new first label proposal for Swift 3.0 applies to returnTypes with Bool:
var firstString = "string"
var secondString = "thing"
func areTheStringsAnagrams(first: String, second: String) -> Bool {
return first.characters.sorted() == second.characters.sorted()
}
areTheStringsAnagrams(first: firstString, second: secondString)
Why is the call to the function unused?
The error is:
/swift-execution/Sources/main.swift:11:1: warning: result of call to 'areTheStringsAnagrams(first:second:)' is unused
areTheStringsAnagrams(first: firstString, second: secondString)
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Although a previous questions focused on NSLayoutConstraints
(i.e., Result of call to [myFunction] is unused) in a comparison to Objective-C, the present question is narrower in that it focuses exclusively on function calls with a returnType
of Bool
in Swift 3.0.