Home
XtGem-
Templates-
XtScript-
Translate this page
Unavailable
Microsoft
®
Translator
Check out this page in {0} translated from {1}
translated from
Original:
Translated:
Automatic translation powered by Microsoft® Translator
Start translating
Stop translating
Close
Close and show original page
Select
Main Index
Predefined Functions
Scripts
Xtforum post
Short Url
if
The
if
statement creates the branches and switches of your Xtscript
[...] = optional ... = your value
if ...
...
[else
...]
endif
"Nested if's" can be a problem in xtscript ... They do not work and should be avoided
Most of these issues can be overcome using
goto
Example code
Show as text
<!--parser:xtscript--> # random number var $x = call mt_rand $min=1;$max=100 # The basic "if" if $x > 50 print \$x is more than 50 <hr /> else print \$x is less than 50<hr /> endif # Strings can also be compared var $a=abcdef var $b=abcdeg if $a < $b print '$a' is less than '$b' <hr /> endif # if's nested like this will not work var $a=1 var $b=2 if $a == 3 if $b == 2 print \$b equals 2 endif print \$a equals 3 ?<hr /> endif # Most of the problems with nested "if's" can be overcome using "goto" if $a == 3 print \$a equals 3 else goto @end endif if $b == 2 print \$b equals 2 endif @end print no output because \$a does not equal 3 so \$b test is skipped <!--/parser:xtscript-->
Show as text
Example output
Reload
$x is more than 50
'abcdef' is less than 'abcdeg'
$a equals 3 ?
no output because $a does not equal 3 so $b test is skipped
Related pages
if and
if or
if not or
if not or not
if elseif
goto
Quick index
assign
basic syntax
comments
concatenation
cookies
custom paging
debugging tools
del
delete
get
goto
if
if and
if elseif
if not or
if not or not
if or
includes
js in xtscript
print
return
source
user defined functions
var
xt files
xtfunctions in xtscript
About us
Contact
Forum