Wednesday, October 31, 2012

Macros


#define.Text('This is a test of macros')
#define.Number(200)

static void Datatypes_macro_library(Args _args)
{
    // Referencing macro library has to be done in the class declaration
    // or in the declaration like in this example
    #MacroTest

    ;
    info(strfmt("Text: %1. Number: %2", #Text, #Number));
}



Local Macro

static void Local_Macro(Args _args)
{
    // Define the local macro    #localmacro.WelcomeMessage    {        info("Welcome to Carz Inc.");
        info("We have the best offers for rental cars");
    }

    #endmacro;  

    // Use the local macro  
    #WelcomeMessage
}

No comments: