Hi apple,

when processed by the template parser that creates:

for x in range(6):
    response.write('\n        ', escape=False)
    break
response.write('\n        ', escape=False)
response.write("hello there")
response.write('\n        ', escape=False)
pass
response.write(' \n\n', escape=False)

so "hello there" is outside the for loop.

The book says in chapter 6:

"A code block starts with a line ending with a colon and ends with a
line beginning with pass. The keyword pass is not necessary when the
end of the block is obvious from the context."

In this case the second sentence applies, the code block ends after
'break'.
Note that 'return', 'continue', or 'raise' would also end a code
block.

Denes.


On Jul 12, 5:14 am, apple <simo...@gmail.com> wrote:
> Why does this show "hello there" on the page?
>
> {{for x in range(6):}}
>         {{break}}
>         {{="hello there"}}
>         {{pass}}

Reply via email to