Variables | functions
In the development application system, I used FoxPro On Error statement to write a function to judge the memory variable exist (), very convenient and practical, introduced to you here.
Design ideas: Assume that the memory variable exists, and then assign the memory variable to be judged to a temporary variable, and if the memory variable does not exist, the execution is bound to make an error, and an On Error statement will be executed when it goes wrong, as long as the memory variable exists in the function on error processing. In order not to affect the error handling of the caller, to ensure the versatility of the function, it is necessary to save and recover the possible error handling of the caller before and after function execution.
The source program is as follows:
existprg***
Para Memovari
Private Mexist,temp,olderror
Mexist=. T. assumes that memory variables exist
Olderror=on (′error′) to save the error handling of the calling program
On Error do Errhandle
temp= Memovari
On error Olderror to recover the calling program's fault handling
Retu Mexist return Presence flag
Proc Errhandle
Mexist=. F. Error is set to exist standard. F.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.