Foxway/If

From Test foxway
Jump to: navigation, search

The development was abandoned in favour of the PhpTags extension.

Without the curly braces

Source:

<foxway debug>
if ( true ) echo "true"; else echo "false"; echo ".\n\n";
if ( false ) echo "true"; else echo "false"; echo ".\n\n";
if ( null ) echo "true"; else echo "false"; echo ".\n\n";
</foxway>

Result:

Debug view
if ( true ) R  echo "true"; R  else { ... } echo ".\n\n"; R 
if ( false ) R  { ... } else echo "false"; R  echo ".\n\n"; R 
if ( null ) R  { ... } else echo "false"; R  echo ".\n\n"; R 
true.

false.

false.


With the curly braces

Source:

<foxway debug>
if ( true ) { echo "true"; echo "true";} else { echo "false"; echo "false"; } echo ".\n\n";
if ( false ) { echo "true"; echo "true";} else { echo "false"; echo "false"; } echo ".\n\n";
</foxway>

Result:

Debug view
if ( true ) R  { echo "true"; R  echo "true"; R } else { ... } echo ".\n\n"; R 
if ( false ) R  { ... } else { echo "false"; R  echo "false"; R  } echo ".\n\n"; R 
truetrue.

falsefalse.


Double If

Source:

<foxway debug>
if( true ) if( true ) {echo "*true"; echo "true\n";} else echo "*falsefalse\n"; else echo "*false\n";
if( true ) if( false ) {echo "*true"; echo "true\n";} else echo "*falsefalse\n"; else echo "*false\n";
if( false ) if( true ) {echo "*true"; echo "true\n";} else echo "*falsefalse\n"; else echo "*false\n";
</foxway>

Result:

Debug view
if( true ) R  if( true ) R  {echo "*true"; R  echo "true\n"; R } else { ... }
if( true ) R  if( false ) R  { ... } else echo "*falsefalse\n"; R  else { ... }
if( false ) R  { ... } else echo "*false\n"; R 

  • truetrue
  • falsefalse
  • false


elseif

Source:

<foxway debug>
if( true ) echo "*one\n"; elseif( true ) echo "*two\n"; else echo "*three\n";
if( false ) echo "*one\n"; elseif( true ) echo "*two\n"; else echo "*three\n";
if( false ) echo "*one\n"; elseif( false ) echo "*two\n"; else echo "*three\n";
</foxway>

Result:

Debug view
if( true ) R  echo "*one\n"; R  elseif { ... }
if( false ) R  { ... } elseif( true ) R  echo "*two\n"; R  else { ... }
if( false ) R  { ... } elseif( false ) R  { ... } else echo "*three\n"; R 

  • one
  • two
  • three


Computing

Source:

<foxway debug>
if ( 5+5 ) echo "hello";
if ( 5-5 ) echo " === FALSE === ";
if ( (5+5)/4 ) echo "world";
if ( -5+5 ) echo " === FALSE === ";
if ( ((74+4)*(4+6)+88)*4 ) echo "!!!";
</foxway>

Result:

Debug view
if ( 5+5 ) R  echo "hello"; R 
if ( 5-5 ) R  { ... }
if ( (5+5)/4 ) R  echo "world"; R 
if ( -5+5 ) R  { ... }
if ( ((74+4)*(4+6)+88)*4 ) R  echo "!!!"; R 
helloworld!!!

Variables

Source:

<foxway debug>
$foo = true;
$bar = false;
if ( $foo ) echo $foo, "\n\n";
if ( $bar ) echo $bar, "\n\n";
if ( $foo + $bar ) echo '$foo + $bar', "\n\n";
</foxway>

Result:

Debug view
$foo = true; R 
$bar = false; R 
if ( $foo ) R  echo $foo, "\n\n"; R 
if ( $bar ) R  { ... }
if ( $foo + $bar ) R  echo '$foo + $bar', "\n\n"; R 
1

$foo + $bar