Sorry for that newbie question.
What means := ?
I see code and sometime := is used and then other place only =
I know such things like += and so on.
That automatically assigns a type to a new variable, eg.
[crayon-5d30af7049c56274807771 inline="true" ]
Local a:=0.1 ' a will be a float
Local b:=1 ' b will be an int
Local c:=New MyClass ' c will be a MyClass object
Local d:=MyFunction() ' d will be whatever MyFunction returns
… the type being taken from the result of the calculation or call after the = sign.
Ah cool.Thanks for answering.
Have two other questions and i won´t open a new thread for that.
arcList:List<ArcWall> a list names arclist.But what means that inside <> ?
I take a look into documentation but nothing to find.Btw. the search in online docs is terrible. 😉
And are there a “easy to understand” explantation for lambda´s in monkey2?
I don´t know what it does.
arcList:List<ArcWall> creates a list with elements of type ArcWall. So every element in your list is an instance of an ArcWall object.
arcList:List<Int> would create a list where every element is of type Int.
With lambdas you can define functions at places where you call them or use them as parameters. Quite some fancy stuff which you do not necessarily need.
Personally I do not like that “:=” stuff because it just hides what type the object has especially when looking at other’s code. It’s just for lazy guys. 😉 Like the auto type keyword in C++.
Many thanks….first i learn more C++ and so some questions besome answered alone 😉
But i think for complete newcomers its hard to start from scratch with monkey2 without a good manual.
Would I be right in saying that a Lambda function is a normal function with the ability to be processed where you write it?
For example, if within the parameter of another function, I needed something to be determined, the result of the Lambda gets passed as the parameter value?
Basically you can see it that way, yes Amon. At some point it’s very handy and useful even though you can create the same results without using lambdas.
Lambdas have access to the local variables, so you avoid writing all the parameters too..
You must be logged in to reply to this topic.
Monkey2 is an easy to use, cross platform, games oriented programming language from Blitz Research.