You need to sign in to do that
Don't have an account?
Disha Saini
Trailhead: Developer Beginner -Get started with Apex module- challenge failing
Hi,
Though i have coded the with the same specification as asked in the challenge but then also challenge failing.
Not sure why this is happening. The issue is actually the code or Trailhead is not working fine.
I am a beginner so facing issue in identifying it.
Need help.
Thanks in advance.
Though i have coded the with the same specification as asked in the challenge but then also challenge failing.
Not sure why this is happening. The issue is actually the code or Trailhead is not working fine.
I am a beginner so facing issue in identifying it.
Need help.
Thanks in advance.
All Answers
Please paste your code here.
Regards,
Ramakant
Skype : ramakant_sul
Below is the SS of error and code.
public class StringArrayTest {
public static List<String> generateStringArray(Integer n)
{
List<String> a= new List<String>();
for(Integer i=0;i<=n;i++)
{
a.add('Test '+i);
System.debug(a[i]);
}
return a;
}
}
Please let me know whats going wrong here.
Please try below code:
Please mark as best answer if helped. Please let mek now if you need any further assistance.
Regards,
Ramakant
Its giving the same error with the above code as it was giving before.
It worked now :)
understood the issue, for loop condition wasn't matching
i used i<=n and because of this loop was running for n+1 time
Thanks Ramakant
I'm struggling with this same challange, and even if the code Ramakant gave makes sense, there is still something wrong with my challange as I get message method either not existing, not static or not giving the asked return.
BR, Sanniminni
"static can only be used on methods of a top level type".
BR, Sanniminni
So check wheteher u are using Capital 'T' and space after Test : it should solve the issue if you are using exact above code.
a.add('Test '+i);