Hi All,
As we all know that we in some scenarios we need to use Ternary operator for reducing code lines. In a single line we can execute multiple cases.
For achieving this, please go through with below code.
Sample Job for ternary operator:
static void GOD_TernaryOperatorEx(Args _args)
{
int a, b, c;
;
a = 9;
c = 8;
b = (a < 10 ) ? info ("Yes") : info ("No");
In above line of code we are executing single condition or in other word we can say "If" Condition.
In this condition we are just testing that "A is greater than 10 or not. If it is, then it will generate info with "Yes"".
Or
b = (a < 10 ) ? ((a < c) ? info ("Yes") : info ("Nope")) : info ("No");
In above line of code we are executing multiple conditions or in other word we can say "If and else if" Condition.
In this condition we are testing that "A is greater than 10 or not. If it is not then it will print No, else it will again check that A is greater than "C" or not. If yes then it will print Yes else it will show Nope.
}
As we all know that we in some scenarios we need to use Ternary operator for reducing code lines. In a single line we can execute multiple cases.
For achieving this, please go through with below code.
Sample Job for ternary operator:
static void GOD_TernaryOperatorEx(Args _args)
{
int a, b, c;
;
a = 9;
c = 8;
b = (a < 10 ) ? info ("Yes") : info ("No");
In above line of code we are executing single condition or in other word we can say "If" Condition.
In this condition we are just testing that "A is greater than 10 or not. If it is, then it will generate info with "Yes"".
Or
b = (a < 10 ) ? ((a < c) ? info ("Yes") : info ("Nope")) : info ("No");
In above line of code we are executing multiple conditions or in other word we can say "If and else if" Condition.
In this condition we are testing that "A is greater than 10 or not. If it is not then it will print No, else it will again check that A is greater than "C" or not. If yes then it will print Yes else it will show Nope.
}
This comment has been removed by the author.
ReplyDeleteIt was a great information and Its really worth reading it.
ReplyDeleteMS Dynamics AX Technical Training in Hyderabad
MS Dynamics AX Online Training
D365 AX Online Training
d365 ax technical online training
d365 ax technical training
Very good explanation. Thank you for sharing.
ReplyDeleteoracle training in chennai
oracle training institute in chennai
oracle training in bangalore
oracle training in hyderabad
oracle training
hadoop training in chennai
hadoop training in bangalore
canlı sex hattı
ReplyDeletejigolo arayan bayanlar
QF2B