+ Start a Discussion
Ashwini ns 5Ashwini ns 5 

Create an Apex class that returns an array (or list) of strings.(Trailhead)

If the code is correct but not accepting in trail head means its because of the space b/w Test and i .

try this code:

public class StringArrayTest {

    public static List<String> generateStringArray(integer lenght){
        
        List<String> st=new List<String>();
        For(integer i=0;i<lenght;i++)
        {
            st.add('Test'+ ' '+ i);   //check this part you need to provide space.
            system.debug(st[i]);
        }
        return st;
    }
}