Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upVariables and Constants
Variables
To initiate a variable you simply use the <var> tag.
<var myVariable=10/>This will initiate an integer with the value 10.
C-code:
int myVariable = 10;Types
Variables have types, by using the type attribute you can define what type the variable should be.
<var myVariable="47884" type="unsigned int" />C-code:
unsigned int myVariable = 47884;
If you do not provide a type attribute, the compiler will try to guess what type you meant.
<var myVariable=10/>Will be seen as int, because 10 is not wrapped in quotes.
<var myVariable='b'/>Will be seen as char, because 'b' is wrapped in single quotes.
<var myVariable="hello mario"/>Will be seen as string (char*), because "hello mario" is wrapped in double quotes.
If the compiler cannot guess the variable type, it will say your code sucks and then you need to provide a type attribute.
Constants
Constants are like variables but instead of being variable, constants are constant, you cannot change them.
To create a constant you use a <const> tag, which works exactly the same as the <var> tag.
<const myConstant=10/>C-code
static const myConstant = 10;