You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What is the general guidance on the use of Constance and where to place them within a script?
For example, I need to declare a URI of $api = "http://127.0.0.1:500/api/path". Is it better to place this variable next to the invoke-RestMethod or place it at the beginning of the script since it's a constant?
The text was updated successfully, but these errors were encountered:
I prefer at the top of the script. The purpose of constants is to be able to reuse them throughout the code, and not have paths. uri's, etc that periodically need updating being spread throughout. Leaving them at the top allows you to make them more visible to the maintainer. I always try to document them well, and that documentation could include clues to where they are used throughout the code, although that documentation in-and-of-itself could become difficult to maintain.
What is the general guidance on the use of Constance and where to place them within a script?
For example, I need to declare a URI of $api = "http://127.0.0.1:500/api/path". Is it better to place this variable next to the invoke-RestMethod or place it at the beginning of the script since it's a constant?
The text was updated successfully, but these errors were encountered: