mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-23 17:41:41 +00:00
noticed a few more
This commit is contained in:
parent
ae712c4f99
commit
36b19ae623
@ -17,7 +17,8 @@ recommended to use other references.
|
|||||||
Welcome to Learn Haxe 3 in 15 minutes. http://www.haxe.org
|
Welcome to Learn Haxe 3 in 15 minutes. http://www.haxe.org
|
||||||
This is an executable tutorial. You can compile and run it using the haxe
|
This is an executable tutorial. You can compile and run it using the haxe
|
||||||
compiler, while in the same directory as LearnHaxe.hx:
|
compiler, while in the same directory as LearnHaxe.hx:
|
||||||
$> haxe -main LearnHaxe3 -x out
|
|
||||||
|
$ haxe -main LearnHaxe3 --interp
|
||||||
|
|
||||||
Look for the slash-star marks surrounding these paragraphs. We are inside
|
Look for the slash-star marks surrounding these paragraphs. We are inside
|
||||||
a "Multiline comment". We can leave some notes here that will get ignored
|
a "Multiline comment". We can leave some notes here that will get ignored
|
||||||
@ -225,7 +226,6 @@ class LearnHaxe3 {
|
|||||||
|
|
||||||
// standard bitwise operators
|
// standard bitwise operators
|
||||||
/*
|
/*
|
||||||
|
|
||||||
~ Unary bitwise complement
|
~ Unary bitwise complement
|
||||||
<< Signed left shift
|
<< Signed left shift
|
||||||
>> Signed right shift
|
>> Signed right shift
|
||||||
@ -233,7 +233,6 @@ class LearnHaxe3 {
|
|||||||
& Bitwise AND
|
& Bitwise AND
|
||||||
^ Bitwise exclusive OR
|
^ Bitwise exclusive OR
|
||||||
| Bitwise inclusive OR
|
| Bitwise inclusive OR
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// increments
|
// increments
|
||||||
@ -388,13 +387,13 @@ class LearnHaxe3 {
|
|||||||
|
|
||||||
// string to integer
|
// string to integer
|
||||||
Std.parseInt("0"); // returns 0
|
Std.parseInt("0"); // returns 0
|
||||||
Std.parseFloat("0.4"); // returns 0.4;
|
Std.parseFloat("0.4"); // returns 0.4
|
||||||
|
|
||||||
// integer to string
|
// integer to string
|
||||||
Std.string(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"
|
||||||
// See documentation for parsing in Std for more details.
|
// See documentation for parsing in Std for more details.
|
||||||
|
|
||||||
|
|
||||||
@ -425,8 +424,8 @@ class LearnHaxe3 {
|
|||||||
The other more extreme option is the "untyped" keyword:
|
The other more extreme option is the "untyped" keyword:
|
||||||
*/
|
*/
|
||||||
untyped {
|
untyped {
|
||||||
var x:Int = 'foo'; // this can't be right!
|
var x:Int = 'foo'; // This can't be right!
|
||||||
var y:String = 4; // madness!
|
var y:String = 4; // Madness!
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -581,7 +580,7 @@ class SimpleEnumTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Enums go much further than simple states, we can also enumerate
|
// Enums go much further than simple states, we can also enumerate
|
||||||
// *constructors*, but we'll need a more complex enum example
|
// *constructors*, but we'll need a more complex enum example.
|
||||||
enum ComplexEnum {
|
enum ComplexEnum {
|
||||||
IntEnum(i:Int);
|
IntEnum(i:Int);
|
||||||
MultiEnum(i:Int, j:String, k:Float);
|
MultiEnum(i:Int, j:String, k:Float);
|
||||||
@ -653,9 +652,7 @@ class TypedefsAndStructuralTypes {
|
|||||||
?optionalString: String,
|
?optionalString: String,
|
||||||
requiredInt: Int
|
requiredInt: Int
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
Typedefs work well with conditional compilation. For instance,
|
Typedefs work well with conditional compilation. For instance,
|
||||||
we could have included this at the top of the file:
|
we could have included this at the top of the file:
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user