I have a var a. I want to create and assign a let b like so: (a, b) = f().
There is not something like (a, let b) = f().
I can’t write let b: Type before because of Error: expression expected, but found 'keyword let'
Making it a var is not a big deal but I wonder if there is a better way to do it.
Without helpers the only thing available is a block capturing a:
let b = block:
var b: Foo
(a, b) = f()
b you could use experimental strictDefs feature (that does controlflow analysis to verify init before first use)
just put this top of file:
{.experimental: "strictDefs".} then you can do
let b: T
(a, b) = f() Thank you this is what I looked for.
The block thing is good to know too.