This AOLserver is running version <%= [info tclversion] %> of Tcl.
<%
# here's an example of escaping to Tcl with <% and executing code
# for its effect on the environment in which we'll evaluate the rest
# of the page. Notice how we use blackslashes to avoid having to
# place the entire SET expression on a single line.
set aquarium_types_and_costs \
[list [list "Lake Malawi Cichlid" 5000] \
[list "Saltwater Community" 7000] \
[list "Reef" 10000] \
[list "Planted Freshwater" 6000] \
[list "Suspended-in-midair Stingray Pond" 45000] \
]
%>
The first element of
<%= $aquarium_types_and_costs
%>
is
<%= [lindex $aquarium_types_and_costs 0] %>
Here are some aquarium plans for the new building:
<%
# we will use ns_puts to add to the viewable page from within this
# page
set total 0
foreach pair $aquarium_types_and_costs {
# let's immediately destructure, preserving some
# semblance of abstraction
set aquarium_type [lindex $pair 0]
set aquarium_cost [lindex $pair 1]
incr total $aquarium_cost
ns_puts "
$aquarium_type will cost \$$aquarium_cost\n"
}
ns_puts "