Sumas y productos

Syntax:

sum <identifier> = <from> to <to> do <body>
sum <identifier> = <from> to <to> by <increment> do <body>
sum <identifier> in <matrix> do <body>
prod <identifier> = <from> to <to> do <body>
prod <identifier> = <from> to <to> by <increment> do <body>
prod <identifier> in <matrix> do <body>

If you substitute for with sum or prod, then you will get a sum or a product instead of a for loop. Instead of returning the last value, these will return the sum or the product of the values respectively.

Si no se ejecuta ningún comando (por ejemplo sum i=1 to 0 do ...), sum devuelve el valor 0 y prod devuelve el valor 1, que es el convenio estándar.

Para los números en coma flotante el redondeo de protección de errores se realiza como en el bucle for. Consulte la the section called “Bucles «for»”.