05-arithmetic-operations.mps is been added
This commit is contained in:
parent
fd29c32ff6
commit
c8c856401e
|
@ -0,0 +1,36 @@
|
|||
set apples=7
|
||||
set pears=8
|
||||
set oranges=9
|
||||
set total=apples+pears+oranges
|
||||
|
||||
; the following two are the first lines of a story
|
||||
|
||||
write "There were ",apples," apples, ",pears," pears and ",oranges," oranges,",!
|
||||
write "a total of ",total," fruits in a basket.",!
|
||||
|
||||
; now let's just concatenate a few strings
|
||||
|
||||
set a="Then, "
|
||||
set b="something happened:"
|
||||
|
||||
write a_b,!
|
||||
|
||||
; let's concatenate strings with numbers too
|
||||
|
||||
set x=1
|
||||
set y=2
|
||||
set z=0
|
||||
|
||||
set d=x_" apple"
|
||||
set e=", "_y_" pears"
|
||||
set f=" and "_z_" oranges were eaten!"
|
||||
|
||||
write d_e_f,!
|
||||
|
||||
; here is the last line of the story
|
||||
|
||||
set total=total-x-y-z
|
||||
set average=total/3
|
||||
|
||||
write "Now there are ",total," fruits in the basket,",!
|
||||
write "the average fruit value is ",average,".",!
|
|
@ -84,6 +84,15 @@ The resulting interpreter is located in `/usr/bin/mumps`.
|
|||
2:3 Hello world
|
||||
2:4 Hello world
|
||||
2:5 Hello world
|
||||
|
||||
### [`05-arithmetic-operations.mps`](https://github.com/programarivm/gpl-mumps-by-example/blob/master/01-the-very-basics/05-arithmetic-operations.mps)
|
||||
mumps 05-arithmetic-operations.mps
|
||||
There were 7 apples, 8 pears and 9 oranges,
|
||||
a total of 24 fruits in a basket.
|
||||
Then, something happened:
|
||||
1 apple, 2 pears and 0 oranges were eaten!
|
||||
Now there are 21 fruits in the basket,
|
||||
the average fruit value is 7.
|
||||
---
|
||||
|
||||
### Contributions
|
||||
|
|
Loading…
Reference in New Issue