Stub generator - cannot use any command after write


I’d like to make some output stub for a community puzzle that requires a loop write at the end. However it looks like the stub generator will consider anything after the first write statement as part of the text to write, e.g.

write number of turns
loop N write game state at turn T

Produces this for Python:

print “write number of turns”
print “loop N write game state at turn T”

Instead of the expected:

print “write number of turns”
for i in xrange(n):
print “game state at turn T”

1 Like

Oh got it - An empty line is required after the write. The same goes for loop in fact, an empty line is needed to end the loop.

Except that if I add an empty line, then Test in IDE reports an “invalid stub generator error” (#563) :cry:

You can use the undocumented “join” syntax:

write number of turns

write join("number of turns")

note that you can also put variable:
write join("constant", var1, var2, "constant2")
write join("constant", var1, var2, "constant2", sep=" separator ")


Will try that. For now I went with a single write and used an ugly rephrasing to get two lines that convey the intended format :slight_smile: