Type Conversion

BlitzMax Forums/BlitzMax Beginners Area/Type Conversion

Whats the syntax? I'm getting an error when trying to add a float to an int.
this is the closest to an understandable error I've gotten. BOB[A].X is a float, the width is an integer.

If Int [BOB[A].X]+BOB[A].Width<0 Then BOB[A].X = GraphicsWidth()

Framework BRL.Blitz
Import BRL.StandardIO
Local a:Int = 5
Local b:Float = 10.0
a= a +b
Print a


Okay, I mean explicit conversion, not implicit. Because some times youll want a float to behave as an int. I thought that that would be understood, but appearently I wasn't clear enough for some.

Nevermind, it was a bogus error. Error was somewhere else in the code and now its converting automatically.

You can convert things like so:

Type P
 Field aField
EndType

Type C extends P
 Field Field2
EndType

MyC:C=new C
MyC.afield=5

Print P(MyC).aField
You don't need to covert it, its just an example.

I'm really sorry for asking this here, but I can't find info. How did you do that black code block? I could really use that for my other post.

http://www.blitzbasic.com/faq/faq_entry.php?id=2

Check that out