Need help with passing user assigned values to Inform7 code

I’m trying to do some simple programming as part of an inform story, but I’m rather new to this particular language.

The following example comes from the Inform7 documentation and I can’t get it to work.
While I won’t be using this example exactly, I will be needing to do something similar with the user passing in the loop parameters.

Can someone help me by adding any other lines required to get it to work as a bare-bones example?
I tend to learn best by seeing how others have tackled something.

To plot a grid with size (S - a number): 
	repeat with x running from 1 to S: 
		say "Row [x]: "; 
		repeat with y running from 1 to S: 
			say " [y] ";
		say "."

When play begins, plot a grid with size 5.

Home is a room.

Mind the tabs. They dictate nesting.

Thanks for the help.

I’m still having some issues, though, when I try to enter the command and parameter from the user prompt.

One would think that this should not be an issue, but it seems to be.

Aha. Your problem is that ‘plot a grid with size 5’ in that example is an instruction for a code function, not an instruction for what to do with the player’s commands. If the latter is what you want, you need to create (or modify) an action.

Thank you.

You understood my problem exactly and the solution works!

I believe I can figure out, now, how to construct similar snippets of code to interact in the same way with the user.