indexing bug? [message #92892] |
Thu, 17 March 2016 22:57  |
Dae-Kyu Shin
Messages: 25 Registered: February 2015
|
Junior Member |
|
|
Hi
for example
arr = indgen(3)
;; in this case, of course error occuring
print, arr[5]
;; but in this case, there is no error
print, arr[[5]]
is this bug??
Thanks
|
|
|
|
Re: indexing bug? [message #92894 is a reply to message #92892] |
Fri, 18 March 2016 00:49   |
Lajos Foldy
Messages: 176 Registered: December 2011
|
Senior Member |
|
|
On Friday, March 18, 2016 at 6:57:28 AM UTC+1, Dae-Kyu Shin wrote:
> Hi
>
> for example
>
> arr = indgen(3)
>
> ;; in this case, of course error occuring
> print, arr[5]
>
> ;; but in this case, there is no error
> print, arr[[5]]
>
> is this bug??
No, it's a feature :-) Array subscripts are clipped, unless STRICTARRSUBS is used:
http://www.exelisvis.com/docs/using_arrays_as_array_su.html
regards,
Lajos
|
|
|
Re: indexing bug? [message #92895 is a reply to message #92894] |
Fri, 18 March 2016 01:01  |
Dae-Kyu Shin
Messages: 25 Registered: February 2015
|
Junior Member |
|
|
2016년 3월 18일 금요일 오후 4시 49분 17초 UTC+9, fawltyl...@gmail.com 님의 말:
> On Friday, March 18, 2016 at 6:57:28 AM UTC+1, Dae-Kyu Shin wrote:
>> Hi
>>
>> for example
>>
>> arr = indgen(3)
>>
>> ;; in this case, of course error occuring
>> print, arr[5]
>>
>> ;; but in this case, there is no error
>> print, arr[[5]]
>>
>> is this bug??
>
> No, it's a feature :-) Array subscripts are clipped, unless STRICTARRSUBS is used:
>
> http://www.exelisvis.com/docs/using_arrays_as_array_su.html
>
> regards,
> Lajos
Good. Thanks Lajos
|
|
|