rsb:else
The rsb:else keyword is used to execute an alternative block of code when a test like rsb:exists or rsb:match fails. It can also be used to execute an alternate block of code within an rsb:call when the call fails to produce any output items.
Unlike other languages, rsb:script requires the rsb:else statement to be within the scope of the test it belongs to. See the examples.
Parameters:
- This keyword does not have any parameters.
Control Attributes:
- This keyword does not have any control attributes.
Examples:
<rsb:notnull attr="rss:title"> <rsb:push/> <rsb:else> <rsb:set attr="rss:title" value="Item"/> <rsb:push/> </rsb:else> </rsb:notnull>
<rsb:info title="FileListElse" description="Feed of empty dir"> <input name="path" desc="Empty dir" default="empty" /> </rsb:info> <rsb:call op="fileListDir" output="out"> <rsb:push title="[rss:title | def('untitled item')]"> [out.*] </rsb:push> <rsb:else> <rsb:push title="No files"> Directory '[path]' is empty. </rsb:push> </rsb:else> </rsb:call>
See Also:
- rsb:exists: To learn now to check if an attribute exists.
- rsb:equals: To learn how to check for equality.