4DIS - JavascriptTutorial - Variables

From Unify Community Wiki
(Difference between revisions)
Jump to: navigation, search
m (Text replace - "</javascript>" to "</syntaxhighlight>")
 
(10 intermediate revisions by 2 users not shown)
Line 5: Line 5:
 
----
 
----
  
'''
+
'''Creating new variables :'''
  
<javascript>
+
<syntaxhighlight lang="javascript">
 
+
// create a new...
+
  
 +
/*
 
var ...name...;
 
var ...name...;
vra ...name... = ...value...;
+
var ...name... = ...value...;
 
var ...name... : ...type...;
 
var ...name... : ...type...;
 
var ...name... : ...type... = ...value...;
 
var ...name... : ...type... = ...value...;
 +
*/
 +
 +
// examples...
 +
 +
var newVarA;
 +
var newVarB = "This is a string";
 +
var newVarC : String;
 +
var newVarD : String = "This is a String.";
 +
 +
</syntaxhighlight>
 +
 +
----
 +
 +
'''Using variables :'''
 +
 +
<syntaxhighlight lang="javascript">
 +
 +
// Write values :
 +
 +
newVarD = "This is an other string";
 +
 +
newVarD += ".";
 +
 +
// Read values :
 +
 +
var x : String = newVarD;
 +
 +
print ( x );
 +
 +
</syntaxhighlight>
 +
 +
----
 +
 +
'''Different types of variables :'''
 +
 +
<syntaxhighlight lang="javascript">
 +
 +
int
 +
float
 +
doule
 +
String
 +
Rect
 +
Vector3
 +
...
  
</javascript>
+
</syntaxhighlight>

Latest revision as of 20:52, 10 January 2012

[edit] Javascript Variables

4DIS - JavascriptTutorial - Back


Creating new variables :

/*
var ...name...;
var ...name... = ...value...;
var ...name... : ...type...;
var ...name... : ...type... = ...value...;
 */
 
// examples...
 
var newVarA;
var newVarB = "This is a string";
var newVarC : String;
var newVarD : String = "This is a String.";

Using variables :

// Write values :
 
newVarD = "This is an other string";
 
newVarD += ".";
 
// Read values :
 
var x : String = newVarD;
 
print ( x );

Different types of variables :

int
float
doule
String
Rect
Vector3
...
Personal tools
Namespaces

Variants
Actions
Navigation
Extras
Toolbox