Saturday, February 11, 2012

Hi ,
This is in regarding script statement,Script statement are nothing but Executable Line in Code .

Example :

1):Conditional Statement
2)Assignment
3)For loop
4)While
5)Transaction Statement

Example:


If(Name =='Mohit')
{
Statement 1;
}
Else
{
Statement 2;
}

In This Code Script Statement is 1 since it is conditional Either Statement 1 or Either 2 Statement will Execute.



Some more Illustration for Optimizing Script Statement..Write Effective code

List<account> lstact=[select id ,name from account where name='abc'];
for(integer i=0;i<lstact.size();i++)
{
string str=lstact[i].name;
}
 Result: Please Note Down Number of script Statement: 3











Code Listing 2: Please Note Down here Number of Script Statement :1

for(account varact:[select id ,name from account where name='abc'])
{
string str=varact.name;
}













Try To reduce : Number of Script Statement.Effective Code writing.

If you feel unappropriate please say,this is my first blog for any mistake i apologize.