How to assign a variable in a Swift case statement : <p>This works but seems inefficient:</p>

<pre><code>switch var1 {
case 1:
    string1 = "hello"
case 2:
    string1 = "there"
default:
    string1 = "world"
}
</code></pre>

<p>but</p>

<pre><code>string1 = switch var1 { ...
</code></pre>

<p>throws an error. Is there a more efficient way to write the switch/case so that the assigned variable isn't listed redundantly in each line?</p>

<p>Thanks in advance!</p>
