How to define many variables in few lines?

Yeah, don’t do this. Create a struct that defines your “problem” which has all those values as fields, and then pass the struct to your functions.

I see you already figured this out:

3 Likes

Thank you all @DNF @jling @lmiq @dlakelan @pdeffebach @Nathan_Boyer @Vasily_Pisarev @lungben @jzr @carstenbauer etc (Sorry it only allow me to mention 10)

All the solutions are great!

Perhaps for a beginner like me, for now things like

a, b, c = (Float64[] for _ in 1:99999)

can be a easy and one size fits all solution. It also reminds me of the Implied do loop in Fortran.

But I believe fancy stuff like @jling did is also very useful!
Thank you all, I very much enjoy reading all of your threads!

1 Like