Avoid subtracting form .length

Dom DiSc dominikus at scherkl.de
Thu Nov 14 13:24:47 UTC 2024


No, no. My problem is: I want to access the last element of an 
array and assign it to the element of same index in another array 
(so I can't use $), and I checked that the source array has at 
least one element.

The questions are:
- Why is it considered dangerous to use the expression a.length-1 
?
- What else is proposed to implement the desired effect without 
warning?


More information about the Digitalmars-d-learn mailing list