Re: Last Element Reference

new topic     » goto parent     » topic index » view thread      » older message » newer message

On Fri, 19 Sep 2003 21:30:35 -0700, Al Getz <Xaxo at aol.com> wrote:

[corrected top-posting]

>Lucius Hilley wrote:
 
>> I don't want negative indexing. I use to like the idea.  But it is too
>> easy for certain bugs to creep in and certain errors to go
>> undetected for a long time.



>Ok, then i guess you will never want to do:

>s="MyFile.exw"
>Name=s[1..6]
>Ext=s[$-3..$]

>in which you have to use a negative '3' anyway.

This is not using negative indexing; this is using a calculated index.  Under
the proposed
format, "$" used as a subscript will always be a non-negative number (I suppose
it could
conceivably be zero), and if $-n is less than zero for a particular value of n,
you would
get an error from Euphoria (as you do now if you try to use a negative subscript
on a
sequence).

--
Jeff Zeitlin
jzeitlin at cyburban.com

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu