BT Diameter 1&2 | global Variable

Hi

I could not understand why global variable is not recommended. How can this be modified? It can also be private.

Regards

Rajan

Hey @connectrajanjain If you had done some leetcode questions you would encountered that i you use a global variable then changes to it by any function will be permanent and you have to look which function made the changes. Global Variables may not be problematic for codes with few number of functions but it can be tedious to find in longer codes which function made the change. There are many more reasons why we don’t use global

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.