Understanding recursion and the THIS keyword
Recursion is a looping concept that isn’t used much in today’s world. However, it is a concept that often pops up in interviews and is something that all software engineers need to understand. In a nutshell, recursion is where a method calls itself. Recursion is a valid concept and is an important concept to know; however, for many applications, some type of loop will be more appropriate.
If you do opt to use recursion, exercise great caution. Recursion is generally considered resource-heavy, and in the automation world, where many PLCs have traditionally limited computing resources compared to full-fledged computers, it can consume precious resources.
Recursion is also somewhat dangerous as it is easy to create what is known as an infinite recursive loop. These loops are recursive loops that continuously call themselves. Many modern compilers do check for this and will usually throw a compile error before the code is...