You need to sign in to do that
Don't have an account?
Abhishek Sharma 527
apex time limit exceeded error
Hello I'm running this program in execute anonymous window in dev console and it's giving apex time limit exceeded error.
my code -
Integer count = 5;
Integer i = 0;
Integer sum=0;
while(i<count){
sum = sum +i;
}
i++;
system.debug(sum);
I'm unable to figure out the issue, Please help.
my code -
Integer count = 5;
Integer i = 0;
Integer sum=0;
while(i<count){
sum = sum +i;
}
i++;
system.debug(sum);
I'm unable to figure out the issue, Please help.
modify the code as below
Integer count = 5;
Integer i = 0;
Integer sum=0;
while(i<count){
sum = sum +i;
i++;
}
system.debug(sum);
All Answers
Ideally i++ should be inside the While Loop I guess. as below.
Let me know if you face any issues.
If this solution helps, Please mark it as best answer.
Thanks,
modify the code as below
Integer count = 5;
Integer i = 0;
Integer sum=0;
while(i<count){
sum = sum +i;
i++;
}
system.debug(sum);