is there any way in Asymptote to check whether a variable exists? Maybe via error handling (like try-except in python)? An alternative would be to search the fields of a structure and check whether a field name exists, but I have not found anything on that either.
Can anyone help me?
Kind regards
Ian
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
To the best of my knowledge, there is no way to check dynamically whether a variable exists. The closest thing I can think of that works is to check whether a struct or array is null. Example:
structfoo{realx;}// Initialize to null [NOTE: "=null" is required here.]foomyreal=null;// \vdotsif(alias(myreal,null)){myreal=newfoo;myreal.x=17;}
I would also note that Asymptote does not support error/exception catching.
What is your use case?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi all,
is there any way in Asymptote to check whether a variable exists? Maybe via error handling (like try-except in python)? An alternative would be to search the fields of a structure and check whether a field name exists, but I have not found anything on that either.
Can anyone help me?
Kind regards
Ian
To the best of my knowledge, there is no way to check dynamically whether a variable exists. The closest thing I can think of that works is to check whether a struct or array is null. Example:
I would also note that Asymptote does not support error/exception catching.
What is your use case?