15.9 Nested Conditionals Example

15.9.1 Source file (various/nested_conditionals.cws)

<h1> This is a minimal example about nested conditionals </h1>

<cows>

accessible = "something";
var = "quote3";

ifdef (accessible) {
  // accessible has been defined so this block will be executed
  print ("<p> The American fast food diet and the meat eating habits");
  print ("of the wealthy around the world support a world food system");
  print ("that diverts food resources from the hungry. <br>");
  print ("A diet higher in whole grains and legumes and lower in beef");
  print ("and other meat is not just healthier for ourselves but also");
  print ("contributes to changing the world system that feeds some");
  print ("people and leaves others hungry. <br>");
  print ("-- Dr. Walden Bello\n");
  // Now, an if statement within the outer ifdef statement
  if (var == "quote1") {
    // var differs from "quote1" so this block will NOT be executed
    print ("We'll never display this ...");
  } else {
    if (var == "quote2") {
      // var differs from "quote2" so this block will NOT be executed
      print ("We'll never display this ...");
    } else {
      if (var == "quote3") {
        // var equals "quote3" so this block will be executed
        print ("<p> There can be no question that more hunger can be");
        print ("alleviated with a given quantity of grain by ");
        print ("completely eliminating animals [from the food");
        print ("production process].  [ ... ] Thus, a given quantity");
        print ("of grain eaten directly will feed 5 times as many");
        print ("people as it will if it is first fed to livestock and");
        print ("then is eaten indirectly by humans in the form of");
        print ("livestock products... <br>");
        print ("-- M. E. Ensminger, Ph.D., former Department of");
        print ("Animal Science Chairman at Washington State University");
      } else {
        // We'd get here if var would differ from "quote1",
        // "quote2" and "quote3"
        print ("We'll never display this ...");
      }
    }
  }
} else {
  // accessible has been defined so this block will NOT be executed
  print ("We'll never display this ...");
}

</cows>

<hr> See G-Cows manual for further details

15.9.2 Resulting HTML file

<h1> This is a minimal example about nested conditionals </h1>

<p> The American fast food diet and the meat eating habits
of the wealthy around the world support a world food system
that diverts food resources from the hungry. <br>
A diet higher in whole grains and legumes and lower in beef
and other meat is not just healthier for ourselves but also
contributes to changing the world system that feeds some
people and leaves others hungry. <br>
-- Dr. Walden Bello

<p> There can be no question that more hunger can be
alleviated with a given quantity of grain by
completely eliminating animals [from the food
production process].  [ ... ] Thus, a given quantity
of grain eaten directly will feed 5 times as many
people as it will if it is first fed to livestock and
then is eaten indirectly by humans in the form of
livestock products... <br>
-- M. E. Ensminger, Ph.D., former Department of
Animal Science Chairman at Washington State University


<hr> See G-Cows manual for further details

15.9.3 Resulting HTML file viewed with the Lynx text-browser


              This is a minimal example about nested conditionals

   The American fast food diet and the meat eating habits of the wealthy
   around the world support a world food system that diverts food
   resources from the hungry.
   A diet higher in whole grains and legumes and lower in beef and other
   meat is not just healthier for ourselves but also contributes to
   changing the world system that feeds some people and leaves others
   hungry.
   -- Dr. Walden Bello

   There can be no question that more hunger can be alleviated with a
   given quantity of grain by completely eliminating animals [from the
   food production process]. [ ... ] Thus, a given quantity of grain
   eaten directly will feed 5 times as many people as it will if it is
   first fed to livestock and then is eaten indirectly by humans in the
   form of livestock products...
   -- M. E. Ensminger, Ph.D., former Department of Animal Science
   Chairman at Washington State University
     _________________________________________________________________

   See G-Cows manual for further details

This manual can be downloaded from http://www.g-cows.org/.