X++ Programming Language Tutorial guide

Rumman Ansari   2019-09-25   Student   Miscellaneous > X++   2623 Share

In this blog we will discuss about some X++ programming syntax. Here we will learn how to write comments in x++, X++ Variable, boolean variable, real variable, date variable, str variable, container variable, if statement, if else statement.


X++ Comments

In this section you will that how to write comments in x++ programming language. There are two types of comments available in x++, single line comments and multiline comments. In the below example you will learn both of them.

Code


static void RummanJob1(Args _args)
{
// This is single line comments

    /*

    This
    is
    multiline
    comment
    */
}

In this section we will learn about the three types of messages

Code


static void RummanJob1(Args _args)
{
    // first: how to show information
        info("This is info");
    // Third: How to show warning
         warning("This is warning.");
    // Second: How to show error
        error("This is a error example");
}

X++ Variable

In this section you will learn different types of variables in x++ programming language.

int variable


static void RummanJob1(Args _args)
{
    // In this section we will work on various types of variables in ax
    // Declaration and initialization of a variable
    // Premitive data types
    // Integer variable
      
    int a ; 
    a = 12;
    info(strfmt("%1", a)); 
}

boolean variable


static void RummanJob1(Args _args)
{
       
    // In this section we will work on various types of variables in ax
    // Declaration and initialization of a variable
    // Premitive data types
    // boolean variable     
    
    boolean bo;
    bo = true;
    info(strfmt("%1", bo)); 

}

real variable


static void RummanJob1(Args _args)
{
       
    // In this section we will work on various types of variables in ax
    // Declaration and initialization of a variable
    // Premitive data types
    // real variable     
    
    real realVariable = 12.4333;
    //realVariable = 12.4333;
    info(strfmt("%1", realVariable)); 

}

date variable


static void RummanJob1(Args _args)
{
       
    // In this section we will work on various types of variables in ax
    // Declaration and initialization of a variable
    // Premitive data types
    // date variable     
    
    date dateVariable = 12\02\1996; 
    info(strfmt("%1", dateVariable)); 

}

str variable


static void RummanJob1(Args _args)
{
       
    // In this section we will work on various types of variables in ax
    // Declaration and initialization of a variable
    // Premitive data types
    // str variable     
    
    str  strVariable = "This is a str variable"; 
    info(strfmt("%1", strVariable)); 

}

container variable


static void RummanJob1(Args _args)
{
       
    // In this section we will work on various types of variables in ax
    // Declaration and initialization of a variable
    // Premitive data types
    // container variable     
    
    container  containerVariable =  ["Welcome", 12021996];
    info(conpeek(containerVariable, 1));
    info(conpeek(containerVariable, 2));

}

X++ Decision Making

if statement


static void RummanJob1(Args _args)
{
       
    // if statement in ax example   
    // by Rumman Ansari
    
    int a;
    a = 2; 
    if(a == 2)
    {
        info("Value of a is 2");
    }

}

if else statement


static void RummanJob1(Args _args)
{
       
    // if else example  
    // by Rumman Ansari
    
    int a;
    a = 2; 
    if(a == 3)
    {
        info("Value of a is 2");
    }
    else{
        info("Value of a is not 2");
    }

}