Skip to content

Instantly share code, notes, and snippets.

@katelessardrad
Last active August 26, 2019 19:12
Show Gist options
  • Save katelessardrad/153d0875bd1c114a0fe5bdbd8e8a0405 to your computer and use it in GitHub Desktop.
Save katelessardrad/153d0875bd1c114a0fe5bdbd8e8a0405 to your computer and use it in GitHub Desktop.
Wk 2 HW: Commenting on Code
public with sharing class CommentingOnCodeExercise {
/**
* Your Assignment is to add comments describing what is being done in the methods below.
* Call out the concepts you learned in your readings and in class.
*/
public static void cartValues() {
//Declare the Integer minimumCartValue and assign value equal to 50
Integer minimumCartValue = 50;
//Add Integer items to the List and define their value
Integer itemA = 10;
Integer itemB = 20;
Integer itemC = 45;
//Declare the Integer cartValue and assign value equal to itemA plus itemB
Integer cartValue = itemA + itemB;
//Declare a Boolean expression where cartValue is greater or equal to minimumCartValue
Boolean cartMinimumMet = cartValue >= minimumCartValue;
//Print the debug log to determine if cartMinimum has been met
System.debug('Have we reached the minimum: ' + cartMinimumMet);
//Add itemC to the cartValue
cartValue = cartValue + itemC;
//Check cartMinimumMet Boolean statement
cartMinimumMet = cartValue >= minimumCartValue;
//Print the debug log to determine if cartMinimum has been met now
System.debug('How about now? : ' + cartMinimumMet);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment