Answer to Exercise 17

| ANSWER TO EXERCISE 17
    Object -> bible "black Tyndale Bible"
      with name "bible" "black" "book",
           initial "A black Bible rests on a spread-eagle lectern.",
           description "A splendid foot-high Bible, which must have survived
               the burnings of 1520.",
           before
           [ w x; Consult:
                   wn = consult_from; w = NextWord();
                   switch(w)
                   {   'matthew': x="Gospel of St Matthew";
                       'mark': x="Gospel of St Mark";
                       'luke': x="Gospel of St Luke";
                       'john': x="Gospel of St John";
                       default: "There are only the four Gospels.";
                   }
                   if (consult_words==1)
                       "You read the ", (string) x, " right through.";
                   w = TryNumber(wn);
                   if (w==-1000)
                       "I was expecting a chapter number in the ",
                                 (string) x, ".";
                   "Chapter ", (number) w, " of the ", (string) x,
                         " is too sacred for you to understand now.";
           ];

Back to the exercise in section 15

Mechanically translated to HTML from third edition as revised 16 May 1997. Copyright © Graham Nelson 1993, 1994, 1995, 1996, 1997: all rights reserved.