Menu

SPC and TAB as variable names?

Anonymous
2016-12-28
2016-12-29
  • Anonymous

    Anonymous - 2016-12-28

    SPC and TAB are supposed to be valid only within a PRINT statement, correct?
    and PC-BASIC variables are not supposed to duplicate any keywords, correct?

    10 print "|";spc(4);"|" ' this works as expected
    20 print spc ' this prints "0", shouldn't it be a syntax error?

    Same thing happens with TAB

     
  • Rob Hagemans

    Rob Hagemans - 2016-12-29

    Both statements are correct, but the keywords in this case are SPC( and TAB(, including the opening bracket. Therefore, SPC and TAB are in fact valid variable names, so long as they are not immediately followed by a (.

    These are the only keywords that include a bracket, although some keywords include a $.

     

    Last edit: Rob Hagemans 2016-12-29
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.