Menu

Strange behaviour while a colon is at the end of a line

Theo
2014-10-02
2014-10-30
  • Theo

    Theo - 2014-10-02

    Strange behaviour while a colon is at the end of a line.

    If a line has 2 or more instructions separated with a colon and the line is (accedently)
    ending with a colon then strange things are happening.


    print "AA"
    print "BB"
    print "CC"
    Output AABBCC; correct


    print "AA"
    print "BB": ' note the colon here
    print "CC"
    Output AABBCC; still correct


    print "AA"
    print " ":print "BB": 'note the colon here
    print "CC"
    Output AA CC; not correct


    print "AA"
    print "":print "BB": 'note the colon here
    print "CC"
    Output AACC2; not correct


    dim test as byte
    test = 252
    print "AA":
    print test:print "BB": 'note the colon here
    print "CC"
    Compiler error: Error: Array/Function TEST:PRINT ;STRING3;: has not been declared


    print "AA"
    print chr(65):print "BB": 'note the colon here
    print "CC" ; output is AA CC
    Compiler infinitive loop


     
  • Anobium

    Anobium - 2014-10-02

    This is a know issue. I am sure the if we ever get to write a code parser this will be fixed. Meanwhile, please ensure you use your colon's carefully. :-)

     
  • pat

    pat - 2014-10-30

    When you write a colon in the line that mean you create a statement.
    In this case it is empty.
    I think the compiler look for something that don't exist.
    result will be indeterminate if this case is not treated.

    you would never to write a colon to end a line ...

    The good question is "why in this case ,there is no error ?"

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.