language question
Monkey Forums/Monkey Programming/language question
| ||
Can anyone explain me what means this: ?, $ and # in the following Method Method DoSomthing?(var1$, var2#) ... End Thank you |
| ||
? means that the method returns a Boolan. # means that the var2 is a Float $ means that var1 is a string Also, integers can be marked with a % character. This are datatype shortcuts, to make the code shorter to write. All in all: ? is the same as :Bool # is the same as :Float % is the same as :Int $ is the same as :String It's common on blitz-esque languages like Monkey. Only a cosmetic thing. In other words: Local name$ = "hello world" is the same as Local name:String = "hello world" and it can be applied to anything: Field myField:Int = 34 Field myField% = 34 Function CalculateDistance#(point1%, point2%) Function CalculateDistance:Float(point1:Int, point2:Int) all of this are the same. |
| ||
I always use these when quickly trying stuff out... and when coding BlitzMax BLIde changes them to the full version so it looks "neater" :) Are these in the Monkey Wiki somewhere? |
| ||
I've been looking for it (I was willing to provide a link here) but haven't been able to find any reference to it. |
| ||
Thank you ! It will help me to understand some code :) |
| ||
Hey, newcomer here, but I remember this from old old Visual Basic code.. back in VB 3 or 4 I think.. since then I've moved on to stricter languages and had all but forgotten about it until I noticed this thread :). |
| ||
I just went to add them to the docs, but it seems ziggy beat me to it! http://blitz-wiki.appspot.com/Language_reference#types |
| ||
How does one add to the documentation? |
| ||
I just went to add them to the docs, but it seems ziggy beat me to it! I'd suggest bulking them up more as they currenty get lost, maybe under a subheading or something... How does one add to the documentation? Mere mortals cannot ;) |
| ||
Mere mortals cannot ;) Haha. I helped create the original version, so does that not by definition make me a GOD in this context? And are gods not by default immortal somehow? ;) However kidding aside :) Any chance to be added to the help staff? |
| ||
Just drop Mark an email -- blitzmunter AT gmail.com. |
| ||
Great, I sent him a mail :) |