![JAR search and dependency download from the Maven repository](/logo.png)
simple3.examples.Functions.txt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of goldengine Show documentation
Show all versions of goldengine Show documentation
Java implementation of Devin Cook's GOLD Parser engine
/*----------------------------------------------------
* Demonstration of user-defined functions and scoping
*--------------------------------------------------*/
// Define global variables to show that scoping works
a = 99
b = 22
// Function/Procedure that doesn't return a value
function SignOn() begin
print "Functions - Demonstrates function calls"
print ""
end
// Function/Procedure with parameters that doesn't a value
function ShowCalculation(a, b) begin
c = a + b
print a + " + " + b + " = " + c
print ""
end
// Function that returns a value
function DoCalculation(a, b) begin
return a + b
end
i = SignOn()
i = ShowCalculation(3, 7)
print "DoCalculation(11, 13) = " + DoCalculation(11, 13)
print ""
print "Validating that globals still are 99,22: " + a + "," + b
© 2015 - 2025 Weber Informatics LLC | Privacy Policy