Here is something to play with:
It's best to imagine the .FruitType extension as the bit which tells the variable what 'kind' of variable it is.
Look at the SetPrice() function:
Now for the FindFruit() function:
Again, this is just like doing:
Hope that helps a little. There is a good explanation about types here:
Definitive Guide to Types
Type FruitType Field name$,price# End Type f.FruitType=New FruitType f\name$="apple" f\price=0.45 f.FruitType=New FruitType f\name$="pear" f\price=0.52 Print "Current Price of Pear = "+f\price SetPrice f,0.32 Print "New Price of Pear = "+f\price f.FruitType=FindFruit("apple") Print "f is pointing to "+f\name$ a$=Input$("RETURN to end ...") End Function SetPrice(fruit.FruitType,value#) fruit\price=value End Function Function FindFruit.FruitType(fruitname$) For fruit.FruitType=Each FruitType If fruit\name$=fruitname$ Return fruit Next Return Null End Function
It's best to imagine the .FruitType extension as the bit which tells the variable what 'kind' of variable it is.
Look at the SetPrice() function:
SetPrice(fruit.FruitType,value#)The fruit variable is turned into a 'FruitType' just as the value is turned into a float by adding the #
Now for the FindFruit() function:
FindFruit.FruitType(fruitname$)This returns a 'type' hence the .FruitType() part.
Again, this is just like doing:
GetFruitName$(fruit.FruitType)In this case the function is set up to return a string because of the $ extension.
Hope that helps a little. There is a good explanation about types here:
Definitive Guide to Types