Skip to content

Instantly share code, notes, and snippets.

@pritaunk
Created September 13, 2017 20:41
Show Gist options
  • Save pritaunk/deb8d670a947d08b723e9bd4eb4fdf39 to your computer and use it in GitHub Desktop.
Save pritaunk/deb8d670a947d08b723e9bd4eb4fdf39 to your computer and use it in GitHub Desktop.
Commenting on code week 1
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 () {
// a variable called minimumCartValue has been declared and assigned a value of 50.
integer minimumCartValue = 50;
//declaring variables itemA, itemB and itemC and assigning values respectively.
integer itemA = 10;
integer itemB = 20;
integer itemC = 45;
//adding up the values for the variable 'cartValue'. in this case it's 30.
integer cartValue = itemA + itemB;
//declaire boolean with variable as cartminimummet and then compare if the cartvalue is greater than or equal to the min.cart value.
Boolean cartMinimumMet = cartValue >= minimumCartValue;
//this is a print debug log to check if the above boolean value is true or false.
system.debug('Have we reached the minimum: '+cartMinimumMet);
//re assigning an additional value to the existing cart value?.
cartValue = cartValue + itemC;
//checking if the cartvalue assigned is greater than or equal to the min.cart value?.
cartMinimumMet = cartValue >= minimumCartValue;
//this is a print debug log to check if the boolean value is now true or false.
system.debug('How about now? : '+cartMinimumMet);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment