logo
Home XtGem- Templates- XtScript- bottom
XtGemmanual

XtScript basics

if elseif

more switches

Example

<!--parser:xtscript-->
# 1 random number
var $x = call mt_rand $min=1;$max=100

# The basic "if elseif"
if $x > 90
  print \$x is more than 90 <hr />
  elseif $x > 80
    print \$x is more than 80<hr />
  elseif $x > 70
    print \$x is more than 70<hr />
  elseif $x > 60
    print \$x is more than 60<hr />
  elseif $x > 50
    print \$x is more than 50<hr />
  elseif $x > 40
    print \$x is more than 40<hr />
  elseif $x > 30
    print \$x is more than 30<hr />
else
  print \$x is less than 30<hr />
endif

print \$x=$x<br />
<!--/parser:xtscript-->

Copy as text

Output reload

$x is more than 70
$x=71

Related

if if and if or
if not or if not or not goto

XtGem manual · all sections

Powered by XtGem
About us Contact Forum top