•
for ( int i = 0; i < length; i++ ){ s.paintAt( x+i , y, paintChar ); }
•Variable i is declared inside for statement
•Surround body with braces {...}for safety
•i++ is short for i
= i+1 (or i
+= 1)
•Can do the same job other ways:
•for
(int col=x+len-1; col >=x; col-- ){ s.paintAt( col , y, paintChar );
•}