Java to D

Matti Niemenmaa see_signature at for.real.address
Fri Jan 4 06:23:42 PST 2008


Jeferson Andrade wrote:
> Hi,
> I have this code in Java :

This kind of question should be posted to the digitalmars.D.learn newsgroup. 
Followup set.

<snip>
>         if (N == 1) return new creal[] { x[0]; }; //the error is in this line
<snip>

If my memory serves me correctly, that creates an array containing only one 
element, whose value is x[0].

A simple and idiomatic D way of doing this is using an array literal:

if (N == 1) return [x[0]];

-- 
E-mail address: matti.niemenmaa+news, domain is iki (DOT) fi



More information about the Digitalmars-d mailing list