Open utterances-bot opened 4 years ago
Hm, should @:structInit be mentioned here? It's very convenient and a bit underused, I think.
@cambiata Good idea, feel free to add it!
Cool, I will, asap.
When I am running the Calculator class then I am getting following error message: Calculator.hx:21: characters 1-6 : Unexpected trace
When I am commenting out the last two trace then the program is running. But as soon as I am uncommenting trace then it is giving error message.
Can you tell me reason for this error message?
@ccpplinux The last part of the snippet (after "// Create a new instance of the Calculator") is meant to represent code that is placed "somewhere", e.g. in a main
method or another function.
Thanks for clarifications. I have created a new class with name CalculatorTest and then placed those code inside main method of that class and it is working now. Thanks a lot for quick clarifications.
The article should be fixed. I don't like this specific kind of pattern and it sometimes confuses me too when people report issues like that.
Declare classes - Beginner - Haxe programming language cookbook
Create a new class with two functions and create a new instance of it.
https://code.haxe.org/category/beginner/declare-classes.html