Fran�ois Van Emelen writes:

>Hi all,
>Could someone explain me this?
>
>P1
>100 a$="SMSQE"
>110 b$=a$(4 to 3)
>120 print b$,len(b$)
>
>Line 120 prints an empty string with length 0.
>
>P2
>100 a$="SMSQE"
>110 b$=a$(4 to 2)
>120 print b$,len(b$)
>
>Line 120 returns the error 'unacceptable array index list'
>
>Question: Why doesn't P1 return the same error as P2?
>
>Any ideas?

Because

len(a$(4 to 4)) = 1,
len(a$(4 to 3)) = 0 - still an acceptable string, but
len(a$(4 to 2)) = -1, is not

It probably saves time not to have to test for these odd cases, and it
returns the "right" answer, in my opinion.

Per


      • ... "Phoebus R. Dokos (Φοίβος Ρ. Ντόκος)"
        • ... Dilwyn Jones
          • ... "Phoebus R. Dokos (Φοίβος Ρ. Ντόκος)"
          • ... Dave P
            • ... "Phoebus R. Dokos (Φοίβος Ρ. Ντόκος)"
            • ... "Phoebus R. Dokos (Φοίβος Ρ. Ντόκος)"
          • ... Bill Waugh
          • ... Marcel Kilgus
  • ... P Witte
  • ... Claude Mourier 00
  • ... RWAPSoftware
    • ... Robert Newson

Reply via email to