Re: Constant Functions
	
	
	
	
On Wed, 23 Aug 2000, John Coonrod wrote:
> A constant is a variable whose value cannot be changed once it is set.
>
> A function is a procedure that returns a value - like in math, sin(x)
> returns a value.
To elaborate just a bit:
A constant in most languages can contain a single value:
pi = 3.1415,
or
name = "Joe Blo"
however, in Euphoria, constants can be that, or any arbitrarily complex
object:
constant first_release = { "Irv Mullins", "irv at ellijay.com", 1.0, 12.99 }
where first_release[1] = my name
         first_release[2] = my e-mail
         first_release[3] = version # 1.0
         first_release[4] = price ($12.99)
These values are fixed. Any attempt to change them within the program
will cause an error.
Likewise, functions can accept, act upon, and return arbitrarily complex
objects:
function upgrade(object release)
release[3] += .1
release[4] += 2.00
return release
end function
obect newrelease
newrelease = upgrade(first_release)
After this call, everything in newrelease is the same as was in first_release,
except the version is now 1.1  and the price is 14.99
Regards,
Irv
	
	
		| 
									Not Categorized, Please Help
						 |  |