Int() to Int?

BlitzMax Forums/BlitzMax Beginners Area/Int() to Int?

Im getting confused about a certain compile error and how to fix it...

Unable to convert from 'Int()' to 'Int'

Heres a quick example. I want a type method to return an integer value but I keep getting the compile error.

I'm really not thinking straight at the moment so I thought someone else can help?

Strict

Type Test
	Field Number:Int
	
	Function Create:Test(Number:Int)
		Local tst:Test = New Test
		tst.Number = Number
		Return tst
	End Function
	
	Method Retreive()
		Return Number
	End Method
End Type

Local getnumber:Test = Test.Create(10)
Local temp = getnumber.Retreive
Print temp


You need to add "()" to your line:

Local temp = getnumber.Retreive()


When a function (or method) returns something, you need to add those.

Cheers. ;-)

See.. told you I wasnt thinking straight, lack of sleep perhaps.