Added another example

This commit is contained in:
hellerve
2015-07-11 23:23:21 +02:00
parent 59ba663ebe
commit e7d02e0e92
2 changed files with 33 additions and 1 deletions

View File

@@ -25,9 +25,28 @@ And you're good to go!
Easy!
````python
```python
import improved
improved.callIMP("n := 5")
# this will return a dictionary containing the key/value pair n/5
```
For a less contrived example, let's calculate the nth fibonacci number
where n is user input:
```python
import improved
x = """
n := read;
fib := 1;
while n > 1 do
fib := n * fib;
n := n -1
end;
write fib
"""
improved.callIMP(x)
```

13
examples/fib.py Normal file
View File

@@ -0,0 +1,13 @@
import improved
x = """
n := read;
fib := 1;
while n > 1 do
fib := n * fib;
n := n -1
end;
write fib
"""
improved.callIMP(x)