
-----------------------------------
Hunter007
Mon Jan 19, 2004 6:26 pm

Function
-----------------------------------
I need to have an understanding of the "function" command (creates function) I have to explain it tommorow and I'm just not getting it-Any help would be greatly appreciated.

-----------------------------------
Tony
Mon Jan 19, 2004 6:38 pm


-----------------------------------
function is a set of operations that return a value. The value is obtrained by ether calculating it from the parameters passed to it, or by fetching the value from else where (such as from a database).

basically function is like a procedure (techincally procedure is a void function) that returns a value. Just like in math really

-----------------------------------
Andy
Mon Jan 19, 2004 6:42 pm


-----------------------------------
think of a function as the black box

you shove something in
and something else comes out

you can shove multiple things in, but only onething comes out

-----------------------------------
Hunter007
Mon Jan 19, 2004 6:45 pm


-----------------------------------
Ok thanks. One more question though. How does this part of my code relate to another if.


function collided (x1, x2, y1, y2, radius : int) : boolean
    for xCheck : x1 - radius .. x1 + radius
        if xCheck >= x2 - radius and xCheck = y2 - radius and yCheck 