% First Example % (when you begin with % the line is a comment) - This is a comment -- % How to sum the first 10 integers % Check if the sum is greater than 100 % % If you run the program with MatLab use this: % disp(' Inizio del programma ') % if you use Ocatvae, just put the script on execution disp(" Program starts ") somma = 0 i = 0 while (i<10) i = i+1; somma = somma + i; end; % show the result i somma % exact closed form formula risultato = (10*(10+1))/2 if somma < 100 disp(" The total sum is less than 100 and it is equal to: ") disp(somma) % warning: with MatLab -> disp('La somma cercata è inferiore a 100 e vale : ') % warning: with MatLab -> disp(somma) end; % warning: with MatLab -> disp (' Program end .. ');