what does "!" mean here?
BlitzMax Forums/BlitzMax Beginners Area/what does "!" mean here?
| ||
I was looking over digesteroids and I seen these methods using "!". What does the ! mean in this. These were all in the same type and nowhere else is any "!" used '#Region Method: SetVelocityFromAngle Method SetVelocityFromAngle(Angle!, Speed!) Self.VelocityX = Sin(Angle) * Speed Self.VelocityY = Cos(Angle) * Speed End Method '#End Region '#Region Method: IncreaseVelocityFromAngle Method IncreaseVelocityFromAngle(Angle!, Speed!) Self.VelocityX :+ Sin(Angle) * Speed Self.VelocityY :+ Cos(Angle) * Speed End Method '#End Region '#Region Method: Angle Method Angle!() Return TPhysicsUtility.DegreesBetweenPoints(Self.X, Self.Y, Self.X + Self.VelocityX, Self.Y + Self.VelocityY) End Method '#End Region |
| ||
It means "Double" (-> a 64 bits floating point) It's like # for Float or % for Int etc ... So, the parameters Angle and Speed are "Double" values |
| ||
He used :double everywhere else in the code odd that these were the only variances Thank you |
| ||
Everybody has it's own code style, so, some use the shortcut symbols (! % # @ $) some other use full litteral type definition (:Int :Byte :Short :Long :...) Then, what frequently happens is that there are part of the codes you'll find here and there, that are copy/paste from the archives or else, so there are part of the code made by someone, and some other part done by someone else that uses a different style. Easy as that :) (And there are also some people that are not very consistant in their syntax, so they mix about everything ... but they are not really the ones to focus on ^_^) |
| ||
*Everybody has it's own code style mine is da best! |
| ||
I believe "##" can also be used for Double Float. |
| ||
Better to be consistent though. If I ever mix any code I go through it and rewrite it so it's consistent. But that's just me ;-) |
| ||
I prefer to type out the :Int, :Float, :Double, etc... A little extra typing, but easier to debug something like thisLocal Radius% = 3.791 Local Area% = Radius * Pi Print Area If you are wondering what the bug is in the example, I used the symbol for Int (%) instead of Float (#). With typing it out, it is easier to spot mistakes like this. |