getJibba - Tutorial

2.Variables

Variables are used to store a value so that it can be used later. In the last lesson we used a variable that we named userName.

userAge = 24 'camel Case
UserAge = 24 'pascal

A variable name should describe what the variable does. It is important to make our code as readable as possible. When naming variables try avoid over abbreviating and use camel case. The green text that follows the ' character are comments.

Comments

It's good practice to comment your code. Comments should help make the code easier to read. They should descibe what the code does without being instructional. Over commenting code can make code harder to read.

Expressions

Expressions are a combination of explicit values that are used to evaluate a return value. The operators we can use in expressions are +-*/<>=().

TextWindow.Write("Enter your age: ")
userAge = TextWindow.ReadNumber()

userAgeDoubled = userAge * 2

TextWindow.WriteLine("Double the User's age is: " + userAgeDoubled)

e.g. x = x + 5 In normal mathematics this expression would be impossible but in coding it's typical. The = sign in this case doesn't mean equals but means assignment. We assign x+5 to x.