+ Start a Discussion
kotipalli srikanthkotipalli srikanth 

integer default value

Hello, Sfdc people.
I referred the following statement somewhere and found an ambiguity;
public return type methodname (integer n )
{
for (integer i=0; i<=n; i++)
{
..............
}
}

The question is the "integer n" has not given any value, so how the for loop executes?
please explain me..
Manj_SFDCManj_SFDC
Your methodname method will be invoked from the other class or in the same class with the value of n being passed as a parameter 
please mark the answer as solved if it helps you 
arpit vijayvergiyaarpit vijayvergiya
Hello
This method will be called in this way new yourclassName().methodName(5);. You will pass parameter value in my case I passed 5. So the loop will execute 5 times.
Thanks,