// // Supporting material for lecture 10 // - scope of variables // import FormatIO.*; public class Demo10 { public static void main(String[] args){ int sum = 0; int i = 0; for (i = 0;i<=10;i++); sum += i; System.out.println(sum); } } // // Yikes! // but bad style!! // prefer for (int i=0;i<10;i++) ... // why do we prefer this? // NOTE: computer scientists count from zero! // NOTE: I do NOT like += ... but that's personal // NOTE: I do like i++ ... strange that //