On Thu, 8 Jan 2026 15:44:52 -0700
Duke Normandin <[email protected]> wrote:

> I'm currently studying the pike manual/chapter_5.html#5.5 Indexing
> 
> A sample quote:
> 
> Function     Syntax    Ident   Returns
> 
> Index       a [ b ]    `[]       Returns the index b from a. 
> 
> Safe Index  a [? b ]   none      Returns the index b from a, returning 0
> instead of an error of a is 0
> 
> Lookup            a ->ident  `->      Looks up the identifier. Same as
>                                 a["ident"].
> 
> I don't understand the `[] and `-> syntax. I need some simple examples of
> usage. Also a ->ident aka a["ident"] escapes me. What is meant by "Ident" i.e.
> "Identifier"?

Found a clue!!

string str;
str = "pike";
str[2];     => 107
`[](str,2)  => 107

Which of these two constructs is preferable?
Is there a reason for having two ways of indexing?
-- 
Duke

Reply via email to