Thanks for the {{pass}} clarification, its clear now
On Saturday, November 18, 2017 at 2:38:28 PM UTC+2, Anthony wrote:
>
>
> And I'd also be grateful if someone just simple explained what {{pass}}
>> does in web2py and where do we place it because i find myself placing it in
>> wrong places and at times it just disrupts the balance of the entire code
>> if i don't place it correctly, that'd mean a lot, thanks.
>>
>
> The use of {{pass}} is explained here:
> http://web2py.com/books/default/chapter/29/05/the-views#The-views. Python
> usually defines code blocks based on indentation, but since the views do
> not require proper Python indentation, we need an alternate way to define
> code blocks when the boundaries are not otherwise obvious -- so you use
> {{pass}} to indicate the end of a code block. For example:
>
> {{if some_condition:}}
> This
> {{else:}}
> That
> {{pass}}
> Now we are outside the "else" block, so this line will always be displayed
> .
>
> Without the {{pass}}, that last line would be part of the "else" block and
> therefore only display conditionally. Note, we do not need a {{pass}} at
> the end of the "if" block above, because the {{else:}} implies the end of
> the "if" block.
>
> Typically, you would need a {{pass}} to indicate the end of an if, else,
> elif, or for block in a view.
>
> Anthony
>
>
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.