0
Could anyone give a couple of examples of when you would need to use a constant?
2 odpowiedzi
+ 1
when you have a value that may need to be changed but not at runtime. Or a value that is repeated several times, such as pi in the example.
- 1
Like intrest value in Bank system , its constant value according to account type and it is used in more than one place but it can change and no need to change this value in each place we use in.
also constants is very useful for default values for properties or calculations instead of writing them every time.
File path , File Name , you will use in your app.