On Sunday, 9 August 2015 at 20:23:00 UTC, Reflexive wrote:
I see that remove() removes the value of the element but keeps
the same size of the array, and replace the value by a new one
at the end. The method :
class sabot{
card[] sabotarray ;
(...)
card getCard(){
card returncard = this.sabotarray[0] ;
this.sabotarray.remove(0) ;
return returncard ;
}
`remove` doesn't update the passed array, but it returns a slice
of it that doesn't include the removed element. To update the
original array, assign the result of `remove` to it:
this.sabotarray = this.sabotarray.remove(0);