23 RECURSION
This chapter covers one of my favorite topics: recursion, or code that calls itself. I’ll start with a much more detailed definition, but the only way to truly understand this concept is through examples, so we’ll step through multiple instances of Batch recursion. One will be the calculation of a factorial, a truly classic example, with another being the conversion of a decimal to a hexadecimal. The last example will be something that’s quintessentially Batch: a recursive search through directories and their subdirectories. Then you’ll learn an important limitation to be aware of before you write code that calls itself.
Get The Book of Batch Scripting now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.