Skip to content

Instantly share code, notes, and snippets.

@asmitakhare
Last active August 17, 2020 17:22
Show Gist options
  • Save asmitakhare/aead32cd2d0c6f9537a13cdff61a6239 to your computer and use it in GitHub Desktop.
Save asmitakhare/aead32cd2d0c6f9537a13cdff61a6239 to your computer and use it in GitHub Desktop.
Week 1 Asmita--Primitive and Assignment
public with sharing class Welcome {
//Welcome! I'm a comment and I'm here to tell you what this particular class file is for. The developer who created this class added
//me so that future developers, like yourself, would have a quick little introduction to what this class does.
//The two little slashes tell the compiler* that everything following on this line is a note
//for humans and not code that needs to be executed
// (* A compiler is the computer program that translates this code into executable computer instructions)
//But you know what? This set of comments is already several lines long and getting longer. I'm tired of typing two slashes every time
/*There. That's better. the '/*' tells the compiler that there are multiple lines of comments coming. It knows everything on this line
and any following lines
and lines
and lines
and lines will continue to be comments
until it sees a */
//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 se 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. */
//Declare variable for Integer
Integer i;
//Assign a value to the variable
i = 2;
/*Declare variable for String and assign a value in the same line*/
String s = 'My String';
}
public static void letsTalkAboutIndents() {
//As you look through the sample code in this org, and other places, you'll probably notice it looks pretty tidy
//That is the magic of indenting. Through simply keeping logical groupings indented the same number of spaces
//and then indenting sub-sections further, you always know what section you're in
//Take a look at different classes in the sample code for this org, and even if you're not quite sure what it's doing yet
//you should see that the indenting makes logical groupings easier.
}
}
@patmcclellan
Copy link

You got it.

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