home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2001 October
/
Chip_2001-10_cd1.bin
/
sharewar
/
gdidbpro
/
data1.cab
/
Example_Files
/
projects
/
default
/
calculator.scp
< prev
next >
Wrap
Text File
|
2000-05-26
|
1KB
|
59 lines
##########################################################
# GDIdb demo script (c) 1998 Global Data Industries
#
# This script works as a simple calculator program.
##########################################################
##########################################################
# declare variables used in script
&defvar(?var1?,?var2?)
##########################################################
# Print the information screen
&cls
&print("Calculator Demo Script")
&print("---------------------------------")
&print("Press cancel or enter \"quit\" to terminate script.")
##########################################################
# the following loop will be evaluated until the user
# presses cancel (or enters quit)
&loop(TRUE)
{
# ?var1? will contain "quit" unless the user
# actually enters a value
&assign(?var1?,"quit")
# get expression from user
&input(?var1?,"Enter Arithmetic expression")
# check that ?var1? does not equal "quit"
&if("?var1?",ne,"quit")
{
# calculate string as arithmetic expression using the
# assign function
&assign(?var2?,?var1?)
# and print the results
&print("?var1?=?var2?")
}
# if ?var1? equals "quit", jump out of the loop
&else
{
&break
}
}