MuPAD Tutorial pp 291-294 | Cite as


  • Christopher Creutzig
  • Walter Oevel


Loops are important elements of MuPAD’s programming language. The following example illustrates the simplest form of a for loop: » for i from 1 to 4 do x:= i ^2; print(″The square of″ i, ″is″, x) end_for: ″The square of″, 1, ″is″, 1 ″The square of″, 2, ″is″, 4 ″The square of″, 3, ″is″, 9 ″The square of″, 4, ″is″, 16 The loop variable i automatically runs through the values 1, 2, 3, 4. For each value of i, all commands between do and end_for are executed. There may be arbitrarily many commands, separated by semicolons or colons. The system does not print the results computed in each loop iteration on the screen, even if you terminate the commands by semicolons. For that reason, we used the print command to generate an output in the above example.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

Copyright information

© Springer-Verlag Berlin Heidelberg 2004

Authors and Affiliations

  • Christopher Creutzig
    • 1
  • Walter Oevel
    • 2
  1. 1.Fakultät EIM-MUniversität PaderbornPaderbornGermany
  2. 2.SciFace Software GmbH & Co.KGPaderbornGermany

Personalised recommendations