Can someone explain this please?

BlitzMax Forums/BlitzMax Beginners Area/Can someone explain this please?

Avon(Posted 2005) [#1]
I was wondering what benefits you get when you add the ":TPixmap" or ":String" type of thing to commands? BlitzMax seems to do the same whether I have them or not, as in the example code below. Any explanations geared towards a relative newbie will be much appreciated!

Strict

Graphics 800,600

' draw box
DrawRect 0,0,31,31
' draw circle
DrawOval 32,0,31,31

' grab first pixmap as box
Local my_box = GrabPixmap(0,0,32,32)
' draw it elsewhere
DrawPixmap my_box,256,256

' grab second pixmap as circle
Local my_circle:TPixmap = GrabPixmap(32,0,32,32)
' draw it elsewhere
DrawPixmap my_circle:TPixmap,512,256

' create a string and draw trimmed contents to screen
Local text$ = "  Hello"
DrawText Trim(text$),0,48
DrawText Trim:String(text$),0,64

Flip

WaitKey

End



Perturbatio(Posted 2005) [#2]
There is no need to add the type identifier after the type of the variable is no longer in question, it can however help in some situations with code readability.


Avon(Posted 2005) [#3]
Ok, thanks for clearing that up. :)