resource implicit()
	op funcA(int, [1:*] int, real, [1:*] real, string[*], char charvar )
						returns real
	proc funcA(i, iarr, r, rarr, s, ch)   returns result  {
		write("funcA: s is ", s)
		result = 2*i + r
		for [ j = lb(iarr) to ub(iarr) ] {
		    result = result + iarr[j]
		}
		for [ j = lb(rarr) to ub(rarr) ] {
		    result = result + rarr[j]
		}
		if (ch == 'A') { result = result + 1
		} else { result = result + -1
		}
	}

	int i = 0;	int iarr[2:4] = (2, 3, 4)
	real r = 5.5;	real rarr[21:24] = (1.1 + r, iarr[3] + 4.7, 8.8, 9.9)
	string[14] s = "masha the bear";	char ch = 'A'
	real x = 3.1*(i = 1)

	real realvar = funcA( i, iarr, r, rarr, s, ch)
	write ("funcA returns ", realvar)

	# 4x3 array of int
	int intarr [1:4][1:3] =
			((1, 2, 3), (4, 5, 6), ([3] 7), ([3] 8))
	# 4x3 array of reals
	real realarr [4][3] =
		((1.1, 2.2, 3.3), (4.4, 5.5, 6.6), ([3] 7.7), (8.0, [2] 8.8))

	procedure factorial(int n ) returns int   fact {
		if (n < 0) { fact = 0
		} else if (n == 0 ) { fact = 1
		} else { fact = factorial(n-1) * n
		}
	}

	int result = factorial(5)
	write (result)
	write (lb(intarr, 1), ub(intarr, 1))
	write (lb(intarr, 2), ub(intarr, 2))
	write (lb(realarr, 1), ub(realarr, 1))
	write (lb(realarr, 2), ub(realarr, 2))

	for [ i = 1 to 4, j = 1 to 3 ] {
		write("[", i, ",", j, "]", intarr[i,j], realarr[i,j])
	}
end
