Simple Array Question

BCS ao at pathlink.com
Fri Jun 1 13:17:24 PDT 2007


Reply to Silv3r,

> When using multi-dimensional arrays I easily get confused as to the
> order of the notation. But why does args[i][] equal args[][i] (code
> below)? I assume args[i][] is the more correct version as only
> args[i][0] gives the correct results?
> 
> -Silv3r
> 

> if(args[i][] == args[][i]) // why does args[i][] equal args[][i]?

args[i][] == get args[i], take all of it as a slice
args[][i] == get all of args as a slice, take [i] of it

in an expression [] is the same as [0..$]




More information about the Digitalmars-d-learn mailing list