Last active
February 23, 2020 01:57
-
-
Save niavesper/8ae00953e1146761477371d2b6061eaf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public with sharing class WeekTwoHomework { | |
public static void conditionalsExercise() { | |
Boolean result; | |
// 1. Write a comparison statement that evauates to false and assign the result to our result variable | |
//Don't forget to maintain indentation! | |
result = 6 > 8; | |
// 2. Declare another boolean variable and write a comparison that evaluates to true, assign it to your variable | |
Boolean result2 = 7 > 3; | |
public static void listsExercise() { | |
//You do this part! | |
//1. Declare a list of Strings called myStringList | |
List <String> myStringList = new List <String>(); | |
//2. Add three string values to your list and print it out in the debug log | |
myStringList.add('Saturn'); | |
myStringList.add('Venus'); | |
myStringList.add('Mars'); | |
System.debug ('Three planets from the solar system are ' + myStringList[0] + ', ' + myStringList[1] + ', and ' + myStringList[2] +'.'); | |
//OR: | |
System.debug ('Three planets from the solar system are ' + myStringList + '.'); | |
//3. Print out the third value in your list of strings using list indexing. | |
System.debug('My favorite solar system planet after Earth is ' + myStringList[2] + '.'); | |
//4. Declare a list of integers and add the values 1,2,3,4,5 all in one line | |
Integer[] myIntegerList = new Integer[]{1, 2, 3, 4, 5}; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Great work..Liked the way you printed the elements of the list using the index and the list all together..solid understanding of List 👍