Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: I prefer my indexes to start at:

by GrandFather (Saint)
on Sep 06, 2022 at 23:17 UTC ( [id://11146728]=note: print w/replies, xml ) Need Help??


in reply to I prefer my indexes to start at:

If it starts at 1 it's an item number, not an item index (which starts at 0). Adopting index/number as a distinguishing nomenclature for the two cases has saved a lot of confusion at $work (ignoring the convention on the other hand has caused a lot of confusion and wasted time).

Any other base number gets the appellation "mistake", although there are some places where a non 0 or 1 base can help clean unusual code up considerably.

Optimising for fewest key strokes only makes sense transmitting to Pluto or beyond

Replies are listed 'Best First'.
Re^2: I prefer my indexes to start at:
by BillKSmith (Monsignor) on Sep 13, 2022 at 14:48 UTC
    Definitely a step in the right direction, but it does not solve the problem. Should we reference array elements by 'item number' or 'index number'? Clearly the choice depends on the application.
    Bill

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11146728]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2024-04-20 00:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found