Skip to content

Instantly share code, notes, and snippets.

@olgaloza
Last active February 19, 2018 22:37
Show Gist options
  • Save olgaloza/cc9704608605b038962b7d08492f3d88 to your computer and use it in GitHub Desktop.
Save olgaloza/cc9704608605b038962b7d08492f3d88 to your computer and use it in GitHub Desktop.
RADWomen(); homework_1_b
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() {
Integer minimumCartValue = 50;//We are declaring a new variable type integer and assigning a value 50 to it
Integer itemA = 10;//We are declaring a new variable type integer and assigning a value 10 to it
Integer itemB = 20;//We are declaring a new variable type integer and assigning a value 10 to it
Integer itemC = 45;//We are declaring a new variable type integer and assigning a value 10 to it
//We are declaring a new variable type integer and assigning a value to it which is a sum of two other variables (30)
Integer cartValue = itemA + itemB;
//We are declaring a new variable type boolean and assigning a value FALSE to it
Boolean cartMinimumMet = cartValue >= minimumCartValue;
//We are printing out in the debug log: "Have we reached the minimum: false"
System.debug('Have we reached the minimum: ' + cartMinimumMet);
//updating the value of variable cartValue to 30+45=75
cartValue = cartValue + itemC;
//updating the value of variable cartMinimumMet to TRUE because 75 is greater or equal 50
cartMinimumMet = cartValue >= minimumCartValue;
//We are printing out in the debug log: "How about now? : true"
System.debug('How about now? : ' + cartMinimumMet);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment