The very basics of C#.
var basically means variable. As you learnt in maths a variable holds a number. In this instance a var could hold an int, (A number with no decimal place) bool, (Basically true or false) string,(Basically words/letters) float, (A number with a decimal) double (64-bit floating point, a little complex for this level). Private means that the variable cannot be accessed by other scripts. Public is vice-versa.
example :
private var int theVariableName = 10;
public var bool theVariableName = false;
public var string theVariableName = "Hi I am a variable";
private var float theVariableName = 7.2f;
When declaring a float the value needs to have an "f" after the number.
No comments:
Post a Comment