I screwed up the title, it returns void for both existent and non-existent keys.

Andrej Mitrovic Wrote:

> In TDPL page 116, for the associative method .remove it states:
> 
> "The remove method returns a bool that is true if the deleted key was in the 
> associative array, or false otherwise"
> 
> In this example the .remove method will return void regardless if the key was 
> found or not:
> 
> import std.stdio;
> 
> void main() {
>     int[string] array = ["test":0, "test2":1];
>     
>     bool found = array.remove("test");
>     bool notfound = array.remove("nothing");
> }
> 
> Errors:
> assoc_test.d(6): Error: expression array TOK44 "test" is void and has no value
> assoc_test.d(7): Error: expression array TOK44 "nothing" is void and has no 
> value

Reply via email to