myMakeList[sep_String, list : {___String}] := StringRiffle[Transpose[{Range[Length@list], list}], "\n", sep];
myMakeList[". ", {"first", "second", "third"}]
Output:
1. first
2. second
3. third
Commentary
That Rosetta Code question was posed thus:
Write a program consisting of two nested functions that prints the following text...
That presupposes a particular form for the solution, a form which is completely unnecessary in Mathematica. Even the "prints" is suspicious.
The outer function (called MakeList or equivalent) is responsible for creating the list as a whole and is given the separator ". " as argument.
Wait, we don't even pass in the list to be numbered? That's just very brittle programming.
It also defines a counter variable to keep track of the item number. This demonstrates how the inner function can influence the variables in the outer function.
But this presupposes an entire programming paradigm! And it's a paradigm that does not reflect the strengths and core idioms of Mathematica.
The premise/motivation was given thus:
In many languages, functions can be nested, resulting in outer functions and inner functions.
I'd take issue with "functions" here. Sure, procedures/subroutines/blocks can be nested, but the main composition strategy with functions is function composition. My solution above uses function composition to accomplish the task. Deconstructing such a compositional pattern into a sequential one with explicit state management is just a bonkers thing to do in Mathematica. If this is one's preferred style, then that's great. It's absolutely fabulous. You will be much more comfortable with C and the whole family of languages that derive from it.
"Well," you say, "they just want to see how different constructs appear in different languages; the actual problem isn't relevant." No, they've biased the solution to such an extent that this is equivalent to asking, "how do you write C-style code in Mathematica?". To me, that's just not an interesting question.
You don't go to Disneyland to look at paintings. Can you find paintings in Disneyland? Sure, lots of them. But if you start critiquing the paintings in the Haunted Mansion, you're missing the point.