(* Programming For[ ] and using it to construct a function *) For[tot=0; i=0,i<8,i++,tot=tot+i ] Ggg :=0 For[ i=0,i<4,i++,Ggg=Ggg+Sin[i z ]] Gg[x_] = Ggg /.z->x Plot[Gg[t],{t,-6,6}]