Re: Definition of terms

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

Can someone tell me and give me an example of; a constant, a
procedure and a function. Also, I'd like to know what the
difference between " and ' is.
>
>8-)
>
>puts(1,"Thanks")
>--Thomas
>
>
>
>
A constant is simply a variable that connot be changed after it
is defined.
IE.
-----------
constant PI=3.1415..etc...
-----------

PI is always the same value. So rather than entering 3.1415....
every place you need it, you can just enter PI.

A procedure is a user defined command that calls other commands
and has no return value.
IE
-----------
constant Yes=1, No=0
procedure Test(atom YesOrNo)
if YesOrNo = Yes then
   puts(1,"The value entered for Test() was Yes")
else
    puts(1,"The value entered for Test() was No")
end if
end procedure
------------

A function is the same as a procedure except it returns a value.
The main difference between procedures and functions, is that
you can use a function in an equation, but not procedures.
IE
----------
constant Yes=1, No=0
function Test(atom YesOrNo)
 return YesOrNo
end function

if Test(1) = Yes then
 puts(1,"The value entered for Test() was Yes")
else
 puts(1,"The value entered for Test() was No")
end if
---------

" is a double quote. Use this the specify a sequence of
characters or a string in other words.
' is an apostrophe or single quote. Use this to specify an
individual character.
IE
"This needs to be in double quotes" -- Valid
'A' -- Valid
'These quotes should be surrounding only a single charcter. This
is not valid syntax.' -- Invalid

Hope th

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

Search



Quick Links

User menu

Not signed in.

Misc Menu