Loop example

This example shows you how to use local variables. There is a loop displaying the content of an array of strings. At each passage in the loop the font size of the string displayed is increased.

<%@ Page Language="eiffel" Description="Eiffel ASP.NET example" %>
<html>
    <body>
	<%local i, j: INTEGER; array: ARRAY [STRING] %>
	<%   array := <<"Hello world", "This is an eiffel ASP.NET example", "using local variables">>
	     from i := 1
	     until i > array.count
    	     loop %>
		<% j := i * i %>
		<font size="<%= j %>"> <%=(array.item(i)).to_cil%> </font>
	<%   i := i + 1
	     end %>
    </body>
<html>

 

Here is the output:

 

[run the example]