1.39. Conditional Statements

Felix supports a traditional procedural if chain. Here is a simple if/do/done:
Start C++ section to tut/examples/tut149a.flx[1 /1 ]
     1: include "std";
     2: // procedural if
     3: proc f(x:int) {
     4:   if x == 1 do print "ONE"; endl; done;
     5: }
     6: 
     7: f 1;
     8: f 2;
     9: 
End C++ section to tut/examples/tut149a.flx[1]
You can also have an else clause:
Start C++ section to tut/examples/tut149b.flx[1 /1 ]
     1: include "std";
     2: // procedural if/else
     3: proc f(x:int) {
     4:   if x == 1 do print "ONE"; endl;
     5:   else print "Not a one .."; endl;
     6:   done;
     7: }
     8: 
     9: f 1;
    10: f 2;
    11: 
End C++ section to tut/examples/tut149b.flx[1]
and even elif clauses:
Start C++ section to tut/examples/tut149c.flx[1 /1 ]
     1: include "std";
     2: // procedural if/do/elif/else
     3: proc f(x:int) {
     4:   if x == 1 do print "ONE"; endl;
     5:   elif x == 2 do print "TWO"; endl;
     6:   else print "Not a one .."; endl;
     7:   done;
     8: }
     9: 
    10: f 1;
    11: f 2;
    12: f 3;
    13: 
End C++ section to tut/examples/tut149c.flx[1]
Any number of statements can be used, including none. You can also use a conditional return or goto instead of the do part:
Start C++ section to tut/examples/tut149d.flx[1 /1 ]
     1: include "std";
     2: // procedural if
     3: proc f(x:int) {
     4:   if x == 1 do print "ONE "; endl;
     5:   elif x == 2 return;
     6:   else print "Weird ";
     7:   done;
     8:   print "Found";
     9: }
    10: 
    11: f 1;
    12: f 2;
    13: f 3;
    14: endl;
    15: 
End C++ section to tut/examples/tut149d.flx[1]