Swift deprecate i++ and c-style for loop
Meta via Digitalmars-d
digitalmars-d at puremagic.com
Wed Feb 24 08:40:03 PST 2016
On Wednesday, 24 February 2016 at 16:37:04 UTC, Suliman wrote:
> https://github.com/apple/swift/blob/master/CHANGELOG.md
>
> func slices() {
> var array = ["First", "Second", "Third", "Fourth"]
> array.removeLast()
> array.removeFirst()
> }
>
> also look very intuitive. I looked at std.algorithm.mutation
> and did not find anything for this. I see only simple remove
> option.
The D equivalent is this:
array = array[0..$ - 1];
array = array[1..$];
Arguably just as intuitive.
More information about the Digitalmars-d
mailing list