Skip to content

Instantly share code, notes, and snippets.

@pritaunk
Last active September 19, 2017 21:40
Show Gist options
  • Save pritaunk/26f8aa85d6ec40a0789baed4ef316807 to your computer and use it in GitHub Desktop.
Save pritaunk/26f8aa85d6ec40a0789baed4ef316807 to your computer and use it in GitHub Desktop.
Week3 homework part 2
public class StringArrayTest {
//The Apex class must be called 'StringArrayTest' and be in the public scope. (done)
//The Apex class must have a public static method called 'generateStringArray'. (done)
//The 'generateStringArray' method must return an array (or list) of strings. (done)
public static list <string> generateStringArray (integer n){
list<string> thislist = new list<string>();
for (integer i=0 ; i<10;i++) {
thislist.add('Test ' + i);
system.debug(thislist[i]);
}
return(thislist);
}
//Each string must have a value in the format 'Test n' where n is the index of the current string in the array.
//The number of returned strings is specified by the integer parameter to the 'generateStringArray' method.
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment