program A B:
print "Hello World, what lovely oceans you have!"
- print "are there", five, "?"
+ print "Are there", five, "?"
print pi, pie, "but", cake
/* When a variable is defined in both branches of an 'if',
case GiveUp:
print "Closest I found was", mid
- size::=55
+ size::= 10
list:[size]number
list[0] = 1234
+ // "middle square" PRNG. Not particularly good, but one my
+ // Dad taught me - the first one I ever heard of.
for i:=1; then i = i + 1; while i < size:
n := list[i-1] * list[i-1]
list[i] = (n / 100) % 10000
- print "Before sort:"
+ print "Before sort:",
for i:=0; then i = i + 1; while i < size:
- print "list[",i,"]=",list[i]
+ print "", list[i],
+ print
for i := 1; then i=i+1; while i < size:
for j:=i-1; then j=j-1; while j >= 0:
t:= list[j]
list[j] = list[j+1]
list[j+1] = t
- print "After sort:"
+ print " After sort:",
for i:=0; then i = i + 1; while i < size:
- print "list[",i,"]=",list[i]
+ print "", list[i],
+ print
bob:fred
bob.name = "Hello"
bob.alive = (bob.name == "Hello")
- print bob.alive
+ print "bob", "is" if bob.alive else "isn't", "alive"