Re: Increment Sequence values
- Posted by Irv Mullins <irvm at ellijay.com> Mar 08, 2001
- 393 views
--Boundary_(ID_HAzAPlvYlKoMi7kSaytTCA) ----- Original Message ----- From: tuncaydin6 at tuncaydin6.screaming.net To: EUforum Sent: Wednesday, March 07, 2001 6:17 PM Subject: Increment Sequence values Hi!! If I have a sequence and want to use each element in the sequence one at a time how would I do this? What is the increment operator? ++? eg: x[1]++? x[1+1]? help!! If you want to use a single element, refer to it as x[n] where n = 1.. length of x given x = {1,3,5,9}, x[3] will be 5 x[3] += 1 adds one to the third element, giving {1,3,6,9} x += 1 adds one to each element, giving {2,4,6,10} if you want to do something with each element, make a loop: for n = 1 to lenght(x) do something with x[n] end for. Regards, Irv --Boundary_(ID_HAzAPlvYlKoMi7kSaytTCA) <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META content="text/html; charset=iso-8859-1" http-equiv=Content-Type> <META content="MSHTML 5.00.2614.3500" name=GENERATOR> <STYLE></STYLE> </HEAD> <BODY bgColor=#ffffff> <DIV> </DIV> <BLOCKQUOTE style="BORDER-LEFT: #000000 2px solid; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px; PADDING-LEFT: 5px; PADDING-RIGHT: 0px"> <DIV style="FONT: 10pt arial">----- Original Message ----- </DIV> <DIV style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B> <A href="mailto:tuncaydin6 at tuncaydin6.screaming.net" title=tuncaydin6 at tuncaydin6.screaming.net>tuncaydin6 at tuncaydin6.screaming.net</A> </DIV> <DIV style="FONT: 10pt arial"><B>To:</B> <A href="mailto:EUforum at topica.com" title=EUforum at topica.com>EUforum</A> </DIV> <DIV style="FONT: 10pt arial"><B>Sent:</B> Wednesday, March 07, 2001 6:17 PM</DIV> <DIV style="FONT: 10pt arial"><B>Subject:</B> Increment Sequence values</DIV> <DIV><BR></DIV> <DIV><FONT face=Arial size=2>Hi!!</FONT></DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2>If I have a sequence and want to use each element in the sequence one at a time how would I do this?</FONT></DIV> <DIV> </DIV> <DIV><FONT face=Arial size=2>What is the increment operator?</FONT></DIV> <DIV><FONT face=Arial size=2>++?</FONT></DIV> <DIV><FONT face=Arial size=2>eg:</FONT></DIV> <DIV><FONT face=Arial size=2>x[1]++?</FONT></DIV> <DIV><FONT face=Arial size=2>x[1+1]?</FONT></DIV> <DIV><FONT face=Arial size=2>help!!</FONT></DIV> <DIV> </DIV> <DIV><FONT face=Arial size=2>If you want to use a single element, refer to it as x[n] where n = 1.. length of x</FONT></DIV> <DIV><FONT face=Arial size=2>given x = {1,3,5,9}, x[3] will be 5</FONT></DIV> <DIV><FONT face=Arial size=2>x[3] += 1 adds one to the third element, giving {1,3,6,9}</FONT></DIV> <DIV><FONT face=Arial size=2>x += 1 adds one to each element, giving {2,4,6,10}</FONT></DIV> <DIV><FONT face=Arial size=2>if you want to do something with each element, make a loop:</FONT></DIV> <DIV><FONT face=Arial size=2>for n = 1 to lenght(x) do</FONT></DIV> <DIV><FONT face=Arial size=2> something with x[n]</FONT></DIV> <DIV><FONT face=Arial size=2>end for.</FONT></DIV> <DIV> </DIV> <DIV><FONT face=Arial size=2>Regards,</FONT></DIV> <DIV><FONT face=Arial size=2>Irv</FONT></DIV> <DIV> </DIV></BLOCKQUOTE> --Boundary_(ID_HAzAPlvYlKoMi7kSaytTCA)--