clear %Clears everything clc %Clears the screen x = 0; %x == 0. for i = 1:1:10 %For i starting at 1, incrementing by one, and finishing at 10... x = x + i; %x equals its previous value + the value of i. %So in the first pass... x == 0 + 1 == 1 % in the 2nd pass... x == 1 + 2 == 3 % in the 3rd pass... x == 3 + 3 == 6 % in the 4th pass... x == 6 + 4 == 10 % ... % in the 10th pass... x == (10+1)*5 = 55 end disp('The value of x is now :'); x