Difference between revisions of "Mixly Block Category - Variables"

From Microduino Wiki
Jump to: navigation, search
Line 10: Line 10:
 
Example:  
 
Example:  
  
 +
''''int some_variable_name = 5;'''
 +
*Data Type =  int
 +
*Name = some_variable
 +
*Value = 5
  
 
Read more here: https://www.arduino.cc/en/Tutorial/Variables
 
Read more here: https://www.arduino.cc/en/Tutorial/Variables

Revision as of 20:47, 27 February 2017

A variable is a place to store a piece of data. It has a name, a value, and a type.

  • Name - The name or label of that specific variable. Variables are named instances of a Data Type.
  • Data Type - There are different data types. Such as integers, floats & doubles (decimals), boolean (true or false), and custom ones. Variables are an instance of a data type.
  • Value - Is the stored value of of the Data Type which is referenced under the Variable Name.

In code the format is usually in this format:

Data_Type Variable_Name = Value;

Example:

'int some_variable_name = 5;

  • Data Type = int
  • Name = some_variable
  • Value = 5

Read more here: https://www.arduino.cc/en/Tutorial/Variables

Declare Variable

After Declaring a Variable

Assign Variable a Value

Access Variable