mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-23 17:41:41 +00:00
fix the other lazy syntax errors
This commit is contained in:
parent
3b278c3e59
commit
64e889d011
@ -199,12 +199,12 @@ class LearnHaxe3{
|
|||||||
|
|
||||||
|
|
||||||
//basic comparison
|
//basic comparison
|
||||||
trace(3 == 2 + " is the value for 3 == 2");
|
trace((3 == 2) + " is the value for 3 == 2");
|
||||||
trace(3 != 2 + " is the value for 3 != 2");
|
trace((3 != 2) + " is the value for 3 != 2");
|
||||||
trace(3 > 2 + " is the value for 3 > 2");
|
trace((3 > 2) + " is the value for 3 > 2");
|
||||||
trace(3 < 2 + " is the value for 3 < 2");
|
trace((3 < 2) + " is the value for 3 < 2");
|
||||||
trace(3 >= 2 + " is the value for 3 >= 2");
|
trace((3 >= 2) + " is the value for 3 >= 2");
|
||||||
trace(3 <= 2 + " is the value for 3 <= 2");
|
trace((3 <= 2) + " is the value for 3 <= 2");
|
||||||
|
|
||||||
//bitwise operators
|
//bitwise operators
|
||||||
/*
|
/*
|
||||||
@ -246,7 +246,7 @@ class LearnHaxe3{
|
|||||||
var k = 0;
|
var k = 0;
|
||||||
while(k < 100){
|
while(k < 100){
|
||||||
// trace(counter); // will print out numbers 0-99
|
// trace(counter); // will print out numbers 0-99
|
||||||
counter++;
|
k++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// do-while loop
|
// do-while loop
|
||||||
@ -278,11 +278,11 @@ class LearnHaxe3{
|
|||||||
|
|
||||||
// Array comprehensions give you the ability to iterate over arrays
|
// Array comprehensions give you the ability to iterate over arrays
|
||||||
// while also creating filters and modifications.
|
// while also creating filters and modifications.
|
||||||
var filtered_n = [for (val in n) if (n != "foo")];
|
var filtered_n = [for (val in n) if (val != "foo") val];
|
||||||
trace(filtered_n + " is the value for filtered_n");
|
trace(filtered_n + " is the value for filtered_n");
|
||||||
var modified_n = [for (val in n) n += '!'];
|
var modified_n = [for (val in n) val += '!'];
|
||||||
trace(modified_n + " is the value for modified_n");
|
trace(modified_n + " is the value for modified_n");
|
||||||
var filtered_and_modified_n [for (val in n) if (n != "foo") n += "!"];
|
var filtered_and_modified_n = [for (val in n) if (val != "foo") val += "!"];
|
||||||
trace(filtered_and_modified_n + " is the value for filtered_and_modified_n");
|
trace(filtered_and_modified_n + " is the value for filtered_and_modified_n");
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////
|
||||||
@ -352,7 +352,7 @@ class LearnHaxe3{
|
|||||||
Std.parseFloat("0.4"); // returns 0.4;
|
Std.parseFloat("0.4"); // returns 0.4;
|
||||||
|
|
||||||
// integer to string
|
// integer to string
|
||||||
Std.toString(0); // returns "0";
|
Std.string(0); // returns "0";
|
||||||
// concatenation with strings will auto-convert to string.
|
// concatenation with strings will auto-convert to string.
|
||||||
0 + ""; // returns "0";
|
0 + ""; // returns "0";
|
||||||
true + ""; // returns "true";
|
true + ""; // returns "true";
|
||||||
@ -412,8 +412,9 @@ class FooClass extends BaseFooClass implements BaseFooInterface{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// setter for _private
|
// setter for _private
|
||||||
function set_property(val:Int) : Void{
|
function set_property(val:Int) : Int {
|
||||||
_private = val;
|
_private = val;
|
||||||
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
// special function that is called whenever an instance is cast to a string.
|
// special function that is called whenever an instance is cast to a string.
|
||||||
@ -443,6 +444,5 @@ interface BaseFooInterface{
|
|||||||
public function baseFunction(x:Int):String;
|
public function baseFunction(x:Int):String;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user