From f9032e0eca3c780870127c410edf5ec85db01560 Mon Sep 17 00:00:00 2001 From: sm4rk0 Date: Tue, 19 May 2015 18:17:35 +0200 Subject: Update haxe.html.markdown Correct the condition variable for "do statement always runs at least once" section --- haxe.html.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'haxe.html.markdown') diff --git a/haxe.html.markdown b/haxe.html.markdown index c807d2d7..9b84a435 100644 --- a/haxe.html.markdown +++ b/haxe.html.markdown @@ -323,7 +323,7 @@ class LearnHaxe3{ var l = 0; do{ trace("do statement always runs at least once"); - } while (i > 0); + } while (l > 0); // for loop /* -- cgit v1.2.3 From 982b98468467c7a85f790fdcea2ff8d425b173de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20Stankovi=C4=87?= Date: Wed, 20 May 2015 14:06:05 +0200 Subject: [haxe/en] Few cosmetic fixes * correct the array name in a for loop iterating on an index * add an assignment for "case _" in first switch example * fix case of variable name in trace for control statement returning as an expression * move some inline comments to a separate line above the statement to prevent text overflow --- haxe.html.markdown | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'haxe.html.markdown') diff --git a/haxe.html.markdown b/haxe.html.markdown index 9b84a435..bbe51c79 100644 --- a/haxe.html.markdown +++ b/haxe.html.markdown @@ -340,7 +340,7 @@ class LearnHaxe3{ // (more on ranges later as well) var n = ['foo', 'bar', 'baz']; for (val in 0...n.length){ - trace(val + " is the value for val (an index for m)"); + trace(val + " is the value for val (an index for n)"); } @@ -375,7 +375,7 @@ class LearnHaxe3{ case "rex" : favorite_thing = "shoe"; case "spot" : favorite_thing = "tennis ball"; default : favorite_thing = "some unknown treat"; - // case _ : "some unknown treat"; // same as default + // case _ : favorite_thing = "some unknown treat"; // same as default } // The "_" case above is a "wildcard" value // that will match anything. @@ -397,7 +397,7 @@ class LearnHaxe3{ // if statements var k = if (true) 10 else 20; - trace("K equals ", k); // outputs 10 + trace("k equals ", k); // outputs 10 var other_favorite_thing = switch(my_dog_name) { case "fido" : "teddy"; @@ -495,8 +495,10 @@ class LearnHaxe3{ // foo_instance.public_read = 4; // this will throw an error if uncommented: // trace(foo_instance.public_write); // as will this. - trace(foo_instance + " is the value for foo_instance"); // calls the toString method - trace(foo_instance.toString() + " is the value for foo_instance.toString()"); // same thing + // calls the toString method + trace(foo_instance + " is the value for foo_instance"); + // same thing + trace(foo_instance.toString() + " is the value for foo_instance.toString()"); /* @@ -524,8 +526,8 @@ class LearnHaxe3{ */ class FooClass extends BarClass implements BarInterface{ public var public_any:Int; // public variables are accessible anywhere - public var public_read (default,null): Int; // use this style to only enable public read - public var public_write (null, default): Int; // or public write + public var public_read (default, null): Int; // enable only public read + public var public_write (null, default): Int; // or only public write public var property (get, set): Int; // use this style to enable getters/setters // private variables are not available outside the class. @@ -534,9 +536,10 @@ class FooClass extends BarClass implements BarInterface{ // a public constructor public function new(arg:Int){ - super(); // call the constructor of the parent object, since we extended BarClass + // call the constructor of the parent object, since we extended BarClass + super(); - this.public_any= 0; + this.public_any = 0; this._private = arg; } -- cgit v1.2.3 From 5816b59be65d47e6377cdad4c72b89f683bd0632 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20Stankovi=C4=87?= Date: Wed, 20 May 2015 14:29:05 +0200 Subject: [haxe/en] Adding colon after comments ...as per @vendethiel's advice --- haxe.html.markdown | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'haxe.html.markdown') diff --git a/haxe.html.markdown b/haxe.html.markdown index bbe51c79..ee214540 100644 --- a/haxe.html.markdown +++ b/haxe.html.markdown @@ -495,9 +495,9 @@ class LearnHaxe3{ // foo_instance.public_read = 4; // this will throw an error if uncommented: // trace(foo_instance.public_write); // as will this. - // calls the toString method + // calls the toString method: trace(foo_instance + " is the value for foo_instance"); - // same thing + // same thing: trace(foo_instance.toString() + " is the value for foo_instance.toString()"); @@ -536,7 +536,7 @@ class FooClass extends BarClass implements BarInterface{ // a public constructor public function new(arg:Int){ - // call the constructor of the parent object, since we extended BarClass + // call the constructor of the parent object, since we extended BarClass: super(); this.public_any = 0; -- cgit v1.2.3