% For loops can appear within other loops
% The following computes
% 	1^1 + 2^2 + 3^3 + ... + n^n
% using for loops this time.

var n:    int;
var sum1: int := 0
var sum2: int := 0

put "Enter a positive whole number: " ..
get n
for i: 1..n
    sum2 := i;
    for j: 2..i
	sum2 := sum2*i
    end for
    sum1 := sum1 + sum2
end for
put sum1

% This "looks" more efficient than the loop
% version.  Is it?
