Skip to content

Instantly share code, notes, and snippets.

@JessWingerden
Last active October 28, 2025 07:07
Show Gist options
  • Select an option

  • Save JessWingerden/0856587ef76ac982c3c057eb9835fb2e to your computer and use it in GitHub Desktop.

Select an option

Save JessWingerden/0856587ef76ac982c3c057eb9835fb2e to your computer and use it in GitHub Desktop.
Week 1 Homework - Jess W
Welcome.apxc
//Ok, let's get started!
public static void youDoThisPart() {
/*Your assignment is to write two comments below this one. They should describe the few lines of code you see below.
Simply describe what the code is doing based on what you learned from readings and in class.
Make one as a single line comment using the // notation. Make the other one a multi line comment using the /* notation.
When you're done, save this file so that it is compiled and stored in Salesforce. */
//Creating and assigning a static variables using Primative Variables//
/*These few lines of code are creating both a Integer and String variables.
The Integer is setting the value of 2, and the String is setting the variable as "My String".
Integer variables store whole numbers and the string variable stores characters*/
WeekOneHomework
public static void primitivesExercise() {
//You do this part!
//1. Declare three primitives variables, an Integer, a String and a Decimal
Integer int1;
Boolean bool1;
String string1;
//2. Assign values to your three new variables
int1 = 34;
bool1 = True;
string1 = 'Look at me assigning a variable in the developer console';
//3. Print out your variables to the debug log
//4. Declare an integer variable and assign a value in the same line
Integer int2 = 35;
Boolean bool2 = False;
String string2 = 'Look at me assigning my second variable in the developer console';
//5. Print out your integer to the debug log
}
}
@vickihenry
Copy link

Great job assigning your instantiating & assigning values to your variables! Don't forget to print the values out to the debug log. I've included an example below. We'll review running your code again today and we'll see the lines printed out to the debug log so you can review what your code is doing as it runs.

//1. Declare three primitives variables, an Integer, a String and a Decimal
Integer int1;
Boolean bool1;
String string1;

    //2.  Assign values to your three new variables
    int1 = 34;
    bool1 = True;
    string1 = 'Look at me assigning a variable in the developer console';
            
    //3.  Print out your variables to the debug log
	System.debug('Look at me printing string1 : ' + string1 + ', bool1 : ' + bool1 + ' and int1 : ' + int1);
    
    //4.  Declare an integer variable and assign a value in the same line
    Integer int2 = 35;
    Boolean bool2 = False;
    String string2 = 'Look at me assigning my second variable in the developer console';
    
    //5.  Print out your integer to the debug log
    System.debug('Look at me printing my integeter int2 : ' + int2);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment