Re: Functions? I'm Lost!!

new topic     » goto parent     » topic index » view thread      » older message » newer message

--Here's a function:

function foo( atom a, atom b)
    return (a+b)
end function

--Here's how it's used.
atom a

a=foo(2,2)   -- the function call
?(a)
a=foo(2,3)
?(a)
?(foo(3,3))

--A function returns a value, so it needs to have someplace for the value to
;

--A procedure doesn't return a value, it just does something

procedure printboo(atom number)
    for i = 1 to number do
        puts(1, "Boo")
    end for
end procedure

printboo(3)
printboo(4)
printboo(5)


Bye
Martin

----- Original Message -----
From: David Roach <roachd_76 at YAHOO.COM>
To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
Sent: Wednesday, May 17, 2000 2:20 PM
Subject: Functions? I'm Lost!!


> Could someone give me an example of how to use a function.
> I just can't seem to grasp the concept. I know they return
> a value. I just can't find an example where anything for the
> function is used any where else in the program. I'm just lost.
> Thanks for your time.
>
>
> Dave
>

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu