logo
Home XtGem- Templates- XtScript- bottom
XtGemmanual

XtScript basics

return

Return a value and exit the function or script

Syntax

return [ ... ][...] optional · ... your value

Notes

return uses the same basic syntax as print
return is designed primarily to be used in functions
Using return in normal Xtsripts may cause unexpected results and failures

Example

<!--parser:xtscript-->
# In functions return will print out its value and exit the function only
function test
  return test value<br />
endfunction
call test
print <b>other Xtscript will be executed</b><br />
<!--/parser:xtscript-->

<!--parser:xtscript-->
# In standard Xtscript return will print out its value and exit the Xtscript parser
var $var = 1
return \$var = $var
print <b> This is not executed</b>
<!--/parser:xtscript-->

<div>Other html on the page will be executed</div>

<!--parser:xtscript-->
print <div> But other xtscripts on the page are not executed </div>
<!--/parser:xtscript-->

Copy as text

Output reload

test value
other Xtscript will be executed
$var = 1
Other html on the page will be executed

Related

print user defined functions

XtGem manual · all sections

Powered by XtGem
About us Contact Forum top