Static Variables TDLByte #25 Dear Developers, The previous TDLBytes gave an overview of Scopes of Variables. With this background, we will start a new topic and explain a type of variable called 'Static Variables'. What is it? A variable can be declared static only inside a function. These variables are initialized only once and they persist their values between function calls. Let's understand the meaning of the same with an example in comparison to normal variable. First while loop Counter = 1 NCounter Initial: 1 Log : 2 Second while loop Counter = 2 NCounter Initial: 1 Log : 2 Third while loop Counter = 3 NCounter Initial: 1 Log : 2 First while loop Counter = 1 SCounter Initial: 1 Log : 2 Second while loop Counter = 2 SCounter Initial: 2 Log : 3 Third while loop Counter = 3 SCounter Initial: 3 Log : 4 Example explained: â€¢ The functions 'Nrmvar' and 'StatVar' have 3 successive calls in the function 'VarVals'. â€¢ Variable 'Ncounter' initialized for every call done to 'NrmVar'. â€¢ Static variable 'SCounter' initialized only once during the first call done to the function 'StatVar'. Thus initial value for every successive call is the value of the variable at the end of the previous call. Stay tuned!