Shop OBEX P1 Docs P2 Docs Learn Events
Custom compiler directives — Parallax Forums

Custom compiler directives

MightorMightor Posts: 338
edited 2007-07-22 08:28 in BASIC Stamp
Hello there,

I am looking to implement conditional compiler directives in my code, i.e. something like this:

' ${__DEBUG__ 1}

#IF ($__DEBUG__ = 1) #THEN
' Debugging code
DEBUG "hello world", CR
#ENDIF




This way I won't need to delete any of those statements when the time comes I want to compile it without all those debug statements. I tried the above and it didn't work (otherwise I wouldn't have posted here, of course, hehe).

Is there a way to do this?

Gr,
Mightor

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
| What the world needs is more geniuses with humility, there are so few of us left.

Comments

  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2007-07-22 07:44
    You can do it like this:

    #DEFINE DEBUG_IT = 1
    
    #IF DEBUG_IT = 1 #THEN
      DEBUG "Hello world.", CR
    #ENDIF
    
    
    


    -Phil
  • MightorMightor Posts: 338
    edited 2007-07-22 08:28
    Phil,
    Phil Pilgrim (PhiPi) said...
    You can do it like this:

    #DEFINE DEBUG_IT = 1
    
    #IF DEBUG_IT = 1 #THEN
      DEBUG "Hello world.", CR
    #ENDIF
    
    
    


    -Phil

    Perfect, thanks!

    Gr,
    Mightor

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    | What the world needs is more geniuses with humility, there are so few of us left.
Sign In or Register to comment.