UNDERSTANDING VARIABLES


PRESS LEFT AND RIGHT KEY TO MOVE THE BASKET , OR USE THE BUTTONS

[h2]WHAT IS A VARIABLE?[h2] variables are a combination of name and value. variable assignment is when a variable is created or updated with a value, such as: *basket = 6* in fig, the = is optional and most lines of code begin with a variable. *basket 6* *firstname "patil"* *lastname "kapoor"* variables have type-- this refers to the kind of data (the value) they are storing. 6 is a numeric value, an integer (whole number without fraction or decimal.) 6.6 would be a "float" (number with a decimal point.) fig treats both types as "numeric" collectively. a value in quotes "like this" is called a string-- a string of characters. this is a value that can hold letters, numbers, punctuation and spaces-- along with a few other characters like "tab." another variable type is the array-- while most variables associate a single name with a single piece of data, an array associates a single name with zero, one or multiple pieces of data. [h2]UNDERSTANDING WITH GAME:[h2] We are taking *basket* as our variable which stores the number of figs(2 or 5 or 6 and so on). Be careful of the rotten figs . (Score is in upper left corner .) *PRESS THE LEFT RIGHT BUTTONS OR LEFT ARROW RIGHT ARROW KEYS ON YOUR KEYBOARD TO MOVE THE BASKET*