#Abort
#Abort Message$
 
Parameters:

    Message$ = The Message you want to display to the user in the abort pop up dialog
Returns: NONE
 

      #Abort is a compile time directive that forces the compiler stop the compilation process. It's really only used when combined the #IF/#ENDIF directives. Since the #IF directives are calculated at compile time, this allows your source to evaluate any constant expressions (like settings) and conditions. So if an expression fails, you could use the #Abort directive to Pop an message (giving a reason) and stop the compile. Rather than allowing the compiler to keep building a project that will probably not run correctly.

      A common usage can occur when you've written a program using a current version of PlayBASIC that you know, won't compile in order versions. So #abort messages are perfect way to force the compiler to not bother compiling this code in older versions. Of course it's always helpful when the abort message tells the user the reason why compliation has been aborted.



FACTS:


      * #Abort is a COMPILE time directive. If the compiler see the #Abort directive in your source, it will pop and message and stop compiling.



Mini Tutorial:


      This example performs a compile time check using the #IF directive against
the PlayBasic version constant. If the Constant (the version number) is greater than 1,(which is always will be) this will force the compilation of the code to stop via the use of the #abort directive.

  
  
  
; Use the Compile Time #IF directive to Check The build number (version)
; of the PlayBASIC compiler.
  
  #IF playbasicversion>1
     
   ; Since the PlayBasicVersion constant is greater than 1 (which it is)
   ; Then when the #if directive is true and compiler is allowed to compile
   ; the code between the #IF / # ENDIF directives
     
   ;  When the compiler sees #ABORT directive it will display a pop up
   ; message and then exit...
     
     #Abort "Sorry - Your trying to compile this program version of PlayBASIC to is new than revision 0.01"
     
  #ENDIF
  
; In this example, The compiler should never get to here!!..
  
  Sync
  WaitKey
  




No Output.

  
  
  

 
Related Info: #ELSE | #ENDIF | #IF | #IFDEF | #IFNDEF | #Warn :
 


(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com