#267 string indexing not working on constants

open
nobody
2014-07-06
2012-10-29
Otter
No

Why constants made by string literals can't be indexed by []?

CONST KEY_UP = CHR(255) + CHR(72)
DIM CH AS STRING
CH = KEY_UP[1]

it is ”expecting end of line” on line 3.

Discussion

  • Otter
    Otter
    2012-10-29

    Oh gosh, have to get along that formatting....
    i mean key_up indexed №1 by brackets

     
  • dkl
    dkl
    2012-10-29

    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1,6 +1,7 @@
    -Why constants made by string literals can't be indexed by []?
    +Why constants made by string literals can't be indexed by \[\]?
    
    -CONST KEY_UP = CHR(255) + CHR(72)
    -DIM CH AS STRING
    -CH = KEY_UP[1]
    +   CONST KEY_UP = CHR(255) + CHR(72)
    +   DIM CH AS STRING
    +   CH = KEY_UP[1]
    +
     it is ”expecting end of line” on line 3.
    
     
  • dkl
    dkl
    2012-10-29

    • summary: Why [] doesn --> string indexing not working on constants
     
  • dkl
    dkl
    2012-10-29

    It looks like string indexing does not work on string constants currently. I think it could be added, as long as the index expression is constant aswell.

     
  • Otter
    Otter
    2012-10-29

    Gee thanks now know.

     
  • dkl
    dkl
    2013-02-18

    Ticket moved from /p/fbc/bugs/633/

    Can't be converted:

    • _component: compiler