-
-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
how to pass default value and check if a key exist in toml file #115
Comments
The (optional) fourth argument in the getter interface for tables is the default value. Usually you do not need to explicitly check for presence. The |
Thanks for the quick explanation. Sorry for my ignorance, but one more question, is the "error handling recipe" you mentioned referring to the I see snippets like this in the How-Tos/Reporting errors
|
I don't think there is an explicit recipe yet targeting this topic. The error reporting recipe does this touch a bit, also there are some mentions in the table handling recipe section. If you have a specific use case it might be useful to add it to the recipes and describe how absent data is dealt with. However, the general design strategy of TOML Fortran's getter interface should allow to minimize the need to worry about the existence of keys or entries. |
Thanks for the explanation. I'm just thinking what I may need for the future, so I don't have an actual use case yet. I will create issue/PR for documentation if I meet and solve problems dealing with absent data in my program. |
I see in the Getting started Tutorials,
But how can I pass the default value? In
call get_value(child, "reverse", reverse, .false.)
, is the fourth argument the default value?Another question, is it possible to check if a key exists in a toml table?
The text was updated successfully, but these errors were encountered: