Wednesday, October 26, 2016

Lesson 1.1 - Variables

Also keep in mind, the examples are java syntax.
more on Variables tho ... before the challenge comes ...
Note that anytime I put some words after // it means I am trying to provide extra information or making additional comments
real Examples of variables in Java are in the format
type variableName

int heightVariable;     // integer variable 
int highestSpeedICanWalk;    //notice another integer variable
string myNameIsHere;       //this is a string variable
decimal litres          //this is variable that can store decimal 

have no spaces and no hyphens but they can have underscores 🙂

As I mentioned before variables are like buckets and we put stuff in buckets. for instance

int mySpeed;
mySpeed = 6 //I just put the value of 6 into the mySpeed bucket aka variable

you can also put another variable into another variable (if an only if they are of the same type) for example
int theBrightness = 12;
int theVolume = 7;
theBrightness = theVolume

I just gave the value of theVolume to theBrightness so now, the value of theBrightness is equal 7 which is equal to the value of theVolume

Its like I pour the content of theVolume into theBrightness. In programming, we always pour from right to left. Yep .. we assign variables from right to left. (U will get used to this soon)

Lesson 1.0 - Variables

Today's lesson is on Variables.
The concept of variables are in every general purpose programming language. Think of variables as buckets that contain things. They can contain anything from integers to letters to words to anything you can imagine, oh yeah anything.

Variables are usually design to take one thing at a time though.
eg: myNiceVariable = 43;
This myNiceVariable here is housing the value 43 which is an Integer.

Variables are also defined by their type for example, you  can say ... hey, see that variable, its an integer variable, or a string or character, decimal etc ... We will get to variable types shortly
From the above example, however, myNiceVariable is an integer variable

The type of variable determines what can be stored in it.

You can give your variable any name of your choice just let it be reasonably short and sensible

myName = "Kojo Yaw Osei"
This is a string variable ( I guess they call it string because its a string of characters(letters) put together)

niceDecimalNumber = 4.32
This is a decimal variable

>>NEXT LESSON

Intro to Programming

Welcome to the first day of the programming training. Since people have different levels of exposure, we will actually start from scratch to accommodate everyone.

Prerequisites however are ...

  • A Love for challenges
  • Out-of-the-box thinking


I'm sure you got these.

cool...lets dive in

>>LESSON 1