Re: 0 vs. 1 with bgt arrays

So @1, are you confused by the 0 based indexing in arrays? I have never in all my time using BGT seen the length method of an array fail to do what it is supposed to do. I'm almost certain it can not be confused with 0 and 1 items. If array.length returns 0, there are 0 items. If array.length returns 1, there is 1 item. If it returns 0 and you try accessing array[0], it will crash because that element doesn't exist. If it returns 1 and you try accessing array[1], it will also crash because it thinks you are trying to access the second element in the array. Arrays are indexed starting at 0, so if array.length returns 1, the proper way to access that element is by accessing array[0]. Hopefully this helps.

-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
  • ... AudioGames . net Forum — Developers room : NicklasMCHD via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : ironcross32 via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : Ty via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : Ty via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : philip_bennefall via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : Lucas1853 via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : NicklasMCHD via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : philip_bennefall via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : philip_bennefall via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : Ty via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : Sam_Tupy via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : Zarvox via Audiogames-reflector

Reply via email to