ERASE example
Compare this example with the equivalent example for delete( ):
erase AFILE
This example lets the user pick a text file to delete:
cFile = getfile("*.txt", "Delete text file from current directory")
if upper(cFile) = set("DIRECTORY") and right(upper(cFile), 4) == ".TXT"
erase (cFile)
else
msgbox("Not a text file in the current directory", "Can't delete", 48)
endif
The beginning of the returned file name is compared with the current directory returned by SET("DIRECTORY") using the equals operator (with SET EXACT OFF). The end of the file name is checked to see if it is a text file.
If the file is a text file in the current directory, the indirection operators convert the file name stored into a name the command can use. Without the indirection operators (or the macro operator, which would have the same effect), the command would attempt to erase the file named "cFile".