337
imd1PTG
5y

True shit.

Comments
  • 17
    ... why use an array then?
  • 3
    .. or zero
  • 8
    Yes you do. A length of 1 is two elements: 0,1. So you'd have to sort it
  • 32
    No? Length and indexing are different things.
  • 3
    @sSam not in some languages. A 0-indexed array with 2 elements will have a length of 1.
  • 3
    @Player2 could you give an example? Not that I don't believe you, I'm just interested.
  • 2
    @sSam perhaps it's changed now, but iirc the older implementations of the .net languages (vb, c#, etc) did.
  • 7
    @Player2 pretty sure that's not true. Length has always returned the number of elements
  • 5
    @Player2 nah, length has always been actual number of elements, even in VB6 (which was indeed 1-indexed, unless you used the options base command, or used VB6 in version of visual studio after they released .NET).

    Source:

    The following declaration reserves 21 elements for the array Weight:
    Dim Weight(20) As Single
    https://msdn.microsoft.com/en-us/...(v=vs.71).aspx
  • 10
    @STRINIX @bguiz I stand corrected. Interesting.

    Thank you
  • 2
    @Player2 from memory, I would say that vb based langages like realbasic (now xojo) had UBound properties that have the highest index in the array
  • 1
    Because it's already sorted 😉
Add Comment