Re: Unpacking Slices

2021-06-14 Thread jfondren via Digitalmars-d-learn
On Monday, 14 June 2021 at 18:08:27 UTC, Justin Choi wrote: Is there any shortcut for unpacking slices like I'd want to do in a scenario like this? `info = readln.strip.split;` `string a = info[0], b = info[1], c = info[2];` This doesn't leave you with multiple local variables, but it leaves

Re: Unpacking Slices

2021-06-14 Thread Vladimir Panteleev via Digitalmars-d-learn
On Monday, 14 June 2021 at 18:08:27 UTC, Justin Choi wrote: Is there any shortcut for unpacking slices like I'd want to do in a scenario like this? `info = readln.strip.split;` `string a = info[0], b = info[1], c = info[2];` I tried to implement PHP's "list" language construct here, which

Re: Unpacking Slices

2021-06-14 Thread Ali Çehreli via Digitalmars-d-learn
On 6/14/21 11:08 AM, Justin Choi wrote: Is there any shortcut for unpacking slices like I'd want to do in a scenario like this? `info = readln.strip.split;` `string a = info[0], b = info[1], c = info[2];` D does not have automatic unpacking. Here is a quick, dirty, and fun experiment: