Re: Functions? I'm Lost!!
On Wed, 17 May 2000 17:20:58 -0400, David Roach <roachd_76 at YAHOO.COM> wrote:
>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
Dave:
Here is a simple example
-- Say I want to create a function that adds 2 numbers
function sum( atom no1, atom no2 )
return no1 + no2
end function
-- to call the function and print the sum of 2 numbers
? sum( 15, 20 )
-- we could just write this
? 15+20
-- but the purpose of function ( which can be very complex ) is
-- to be defined only ONCE in your program and be called through out
-- your program to perform the task over and over again and return a
-- VALUE. Remember the big different is that a VALUE is return in a
-- function and NO VALUE is return from a procedure.
Bernie
|
Not Categorized, Please Help
|
|