It is not necessary but it makes clear where the function is used. Since the other nested functions do use the variables local to PrintTable I find it much nicer to have them all as nested functions.