Using the guard condition in the body of statement
<p>I'm making a url request in Swift and want to print a meaningful error including the response code should their be one. I'm attempting to do this in as few lines of code as possible. The error I'm getting in XCode is the following : <code>Variable declared in 'guard' condition not usable in its body</code>. </p>

<p>How can I perform the following without bloating the code to more lines, is it possible?</p>

<pre><code> //check to see if we got a valid response code
    guard let resCode = (response as? NSHTTPURLResponse)?.statusCode where resCode == 200 else {
        return NSError(domain: "Error with request", code: 1, userInfo: [NSLocalizedDescriptionKey: "Recieved the following status code: \(resCode)"])
    }
</code></pre>

<p>The error occurs with my attempting to use the variable <code>resCode</code> within the body of the guard statement. </p>