
-----------------------------------
Danjen
Mon Mar 12, 2007 12:03 am

Functions inside records
-----------------------------------
Here's what I have so far:

var Skill :
    record
        Firebolt : fcn
            Firebolt (sLv, intH : int) : real
    end record

put Skill.Firebolt(5,10)

It displays a variable has no value error ... where and how would I correct this?

-----------------------------------
Clayton
Mon Mar 12, 2007 6:50 am

Re: Functions inside records
-----------------------------------
that's because you have not given Firebolt any value. All it knows is that Firebolt should hold a function with two integer parameters. You have to create the function outside of the record, and assign that function to Firebolt like so:


fcn firebolt (sLvl, intH : int) : real
    result 5 %just randomly
end firebolt

var skill :
     record
         spell : fcn foo (sLvl, intH : int) : real
     end record

skill.spell := firebolt

put skill.firebolt (10, 22)


;)
