Icon

Icon is another language invented by Ralph Griswold the inventor of Snobol4. This program does not demonstrate the exotic features of this language, but it does give a taste of the code structure.

This program compiles and runs under the University of Arizona Icon compiler..


procedure main()


local i,j,Candidates


Candidates := table()


every i := 0 to 1000 do


Candidates[i] := 1


i := 0


Candidates[0] := 0


Candidates[1] := 0


while i<1000 do {


while i<1000 & Candidates[i] = 0 do


i := i + 1


if i < 1000 then {


j := 2


while (i*j) < 1000 do {


Candidates[i*j] := 0


j := j + 1


}


i := i + 1


}


}


write("prime list")


every i := 0 to 999 do {


if Candidates[i] ~= 0 then {


write(i," is prime")


}


}


end

Click Here for the actual code.