On Tue, Apr 17, 2012 at 10:28:31PM +0200, maarten van damme wrote: > Just for fun I decided to complete some codejam challenges in D. At > some point I wanted to add structs to an array but I got a compiler > error. What am I doing wrong? > > code: > struct test{ > int x; > int y; > } > void main(){ > test[] why; > why~={3,5}; > } > > error: > wait.d(7): found '}' when expecting ';' following statement > wait.d(8): found 'EOF' when expecting ';' following statement > wait.d(8): found 'EOF' when expecting '}' following compound statement > > Is there any reason a why this wouldn't work?
Try this: why ~= test(3,5); T -- Tell me and I forget. Teach me and I remember. Involve me and I understand. -- Benjamin Franklin