Código finalizado para PaymentLib.egl después de la lección 7

El código siguiente es el texto del archivo PaymentLib.egl después de la lección 7.
package libraries;

library PaymentLib type BasicLibrary{}

   categories string[] =[

      "Rent",          // 1
      "Food",          // 2
      "Entertainment", // 3
      "Automotive",    // 4
      "Utilities",     // 5
      "Clothes",       // 6
      "Other"          // 7
   ];
      function getCategoryDesc(cat int in) returns(string)
      if(cat)       // el entero no es 0
         return(categories[cat]);
      else
         return("");
      end
   end

   function getCategoryNum(desc string in) returns(int)
      for(i int from 1 to categories.getSize())
         if(categories[i] == desc)
            return(i);
         end
      end
         return(0);	// no hay coincidencia
   end
end

Comentarios