Author Topic: IF/THEN problem with "\"  (Read 3198 times)

MrTAToad

  • Guest
IF/THEN problem with "\"
« on: 2015-Dec-01 »
If you have something like

Code: (glbasic) [Select]
IF a$="\\" then debug "Hello"

all code after the conditional check is never converted to uppercase, generating compiler errors.

If you split the code over multiple lines, then everything is okay

Offline Slydog

  • Prof. Inline
  • *****
  • Posts: 932
  • KodeSource
    • View Profile
    • KodeSource
Re: IF/THEN problem with "\"
« Reply #1 on: 2015-Dec-02 »
Strange problem.
Is it interpreting the escape characters \" before (or after) the \\ is interpreted?

You could change it to:
Code: (glbasic) [Select]
IF a$=CHR$(92) THEN DEBUG "Hello"
« Last Edit: 2015-Dec-02 by Slydog »
My current project (WIP) :: TwistedMaze <<  [Updated: 2015-11-25]

Offline spacefractal

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 3930
    • View Profile
    • Space Fractal
Re: IF/THEN problem with "\"
« Reply #2 on: 2015-Dec-02 »
im thinks im have accounted this nearly from im discovered glbasic. the CHR$ is the way to go. Im dont thinks glbasic intepreting the escape correctly.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation and The beagle Jam.

Offline Ian Price

  • Administrator
  • Prof. Inline
  • *******
  • Posts: 4160
  • On the shoulders of giants.
    • View Profile
    • My Apps
Re: IF/THEN problem with "\"
« Reply #3 on: 2015-Dec-02 »
Yeah. It was something I posted about years ago when using it as part of a string.
I came. I saw. I played.

MrTAToad

  • Guest
Re: IF/THEN problem with "\"
« Reply #4 on: 2015-Dec-03 »
Yes, I thought it had been mentioned before.

Quote
Is it interpreting the escape characters \" before (or after) the \\ is interpreted?
I dont know - using CHR$ will be needed though

Offline sf-in-sf

  • Mr. Drawsprite
  • **
  • Posts: 93
  • Artist F.P. Brixey
    • View Profile
    • My computed art project
Re: IF/THEN problem with "\"
« Reply #5 on: 2015-Dec-05 »
Yes the escape character is tricky. could you use / instead? even for a path name ? try once c:/here/there/file.ext
Could you use KEY() if you just get the keyboard input ? Good luck!
On the day the atom is a cube I will start believing in the square pixel.