difficulty with rectangular arrays
Moth
postmaster at gmail.com
Fri Jun 11 08:53:12 UTC 2021
On Friday, 11 June 2021 at 08:40:51 UTC, jfondren wrote:
> The example in the spec is in a function body and you've copied
> it to a class body, where the writeln() would also be in error.
> I find https://dlang.org/spec/grammar.html quite hard to read
> but I imagine there's a state/declaration distinction there,
> despite
> the code looking the same.
>
> This works:
>
> ```d
> class Example {
> double[6][3] matrix;
> this() {
> matrix = 0;
> }
> }
> ```
i see.
that's a bummer - i knew the `writeln()` wouldn't work in a class
body, but i assumed that because other initializations work [e.g,
`int myint = 4;` or `int[69] funny = 420;`], this case would be
much the same. ah well.
off topic, your baba is you avatar is very cute.
More information about the Digitalmars-d-learn
mailing list