Skip to content

Instantly share code, notes, and snippets.

@scottswaaley
Created August 3, 2016 16:59
Show Gist options
  • Save scottswaaley/d28f1e44a26f8039b825b50eb08ddd78 to your computer and use it in GitHub Desktop.
Save scottswaaley/d28f1e44a26f8039b825b50eb08ddd78 to your computer and use it in GitHub Desktop.
int myNum; // declares an integer named myNum
myNum= 13; // sets the integer named myNum equal to 13
int myNum= 13; // simultaneously declares an integer named myNum and sets it equal to 13
float myDec; // declares a decimal named myDec
myDec= 13.001; // sets the decimal named myDecequal to 13.001
float myDec= 13; // simultaneously declares a decimal named myDecand sets it equal to 13
char theChar; // declares a character named theChar
theChar = ‘a’; // sets the character named theChar equal to the letter ‘a’. Notice that the character is surrounded my apostrophes.
char theChar = ‘c’; // simultaneously declares a character named myNum and sets it equal to the letter ‘a’. Notice that the character is surrounded by apostrophes.
String someWord; // declares a String named someWord
someWord = “Hello Scott”; // sets the String named someWord equal to “Hello Scott”. Notice that the text itself is surrounded by quotations.
String someWord = “Goodbye Scott!”; // simultaneously declares a String named someWord and sets it equal to “Goodbye Scott!”. Notice that the text itself is surrounded by quotations.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment