Difference between revisions of "Multiple expressions in for loops"

From CodeCodex

(Implementations)
(Implementations)
Line 1: Line 1:
==Implementations==
+
I wanted to spend a mintue to thank you for this.
===Java===
+
You do it "à la C".
+
<pre class="java">
+
public class MultipleFor{
+
  public static void main (String [] args){
+
    for (int i=0, j=0; i < 10; i++, j--)
+
      System.out.println ("i = " + i + " j= " + j);
+
    }
+
}
+
</pre>
+
 
+
=== Tcl ===
+
<pre class="tcl">
+
for {set i 0;set j 0} {$i < 10} {incr i;incr j -1} {puts "i = $i j = $j"}
+
</pre>
+
 
+
[[Category:Java]]
+
[[Category:Tcl]]
+

Revision as of 01:25, 7 January 2012

I wanted to spend a mintue to thank you for this.