Author Topic: (removed)  (Read 4306 times)

0 Members and 1 Guest are viewing this topic.

Offline AGVolnutt

  • LV3 Member (Next: 100)
  • ***
  • Posts: 58
  • Rating: +4/-0
    • View Profile
(removed)
« on: May 26, 2011, 08:04:53 pm »
(removed)
« Last Edit: April 11, 2012, 01:33:42 am by AGVolnutt »

Offline Freyaday

  • The One And Only Serial Time Killing Catboy-Capoeirista-Ballerino
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1970
  • Rating: +128/-15
  • I put on my robe and pixel hat...
    • View Profile
Re: Some code assistience.
« Reply #1 on: May 27, 2011, 03:19:06 am »
Whilst editing a program, press PRGM and then press 4
Congratulations! you now have a For( in program!
This is the command for a For loop. The syntax is
For(VAR(A~theta),starting value, end value[, increment]
.code goes here
End
The part in brackets is optional. If you leave it off, the increment is 1.
What a For loop does is it sets VAR to the starting value, executes the code, adds Increment to VAR, then checks to see if VAR is > (< if increment is negative) the ending value, and loops if it isn't.
In other news, Frey continues kicking unprecedented levels of ass.
Proud member of LF#N--Lolis For #9678B6 Names


I'm a performer at heart; I stole it last week.
My Artwork!

Offline AGVolnutt

  • LV3 Member (Next: 100)
  • ***
  • Posts: 58
  • Rating: +4/-0
    • View Profile
Re: Some code assistience.
« Reply #2 on: May 27, 2011, 11:48:58 am »
Thanks but...
That's for TI-84. XD

I forgot to mention I'm working with nSpire code.
Sorry.

BUT! I did look up the "For" command in my reference guide. I'll take your advice and be sure to figure out how it works!

Thank you!

Offline Freyaday

  • The One And Only Serial Time Killing Catboy-Capoeirista-Ballerino
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1970
  • Rating: +128/-15
  • I put on my robe and pixel hat...
    • View Profile
Re: Some code assistience.
« Reply #3 on: May 27, 2011, 02:36:53 pm »
I think For loop syntax doesn't change much, if at all, between languages, it's a pretty common structure, but it can't hurt to check. Oh, and I forgot to mention that an increment of 0 is never valid
In other news, Frey continues kicking unprecedented levels of ass.
Proud member of LF#N--Lolis For #9678B6 Names


I'm a performer at heart; I stole it last week.
My Artwork!

Offline AGVolnutt

  • LV3 Member (Next: 100)
  • ***
  • Posts: 58
  • Rating: +4/-0
    • View Profile
Re: Some code assistience.
« Reply #4 on: May 27, 2011, 05:50:32 pm »
SO
I think For loop syntax doesn't change much, if at all, between languages, it's a pretty common structure, but it can't hurt to check. Oh, and I forgot to mention that an increment of 0 is never valid

So I should make sure that my inputted n is +1'd before I the program goes on, right?

Offline Freyaday

  • The One And Only Serial Time Killing Catboy-Capoeirista-Ballerino
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1970
  • Rating: +128/-15
  • I put on my robe and pixel hat...
    • View Profile
Re: Some code assistience.
« Reply #5 on: May 27, 2011, 06:07:31 pm »
No, that's not it. In fact, a For loop sets the variable to the starting value at the very beginning.
What I meant was that
For(foo,bar,baz,0
is invalid code in any language, because the increment is 0
In other news, Frey continues kicking unprecedented levels of ass.
Proud member of LF#N--Lolis For #9678B6 Names


I'm a performer at heart; I stole it last week.
My Artwork!

Offline Runer112

  • Moderator
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Some code assistience.
« Reply #6 on: May 27, 2011, 06:11:42 pm »
An increment of zero can be valid in some languages. It will just likely freeze/crash your program unless you manually increment the variable yourself or jump out of the loop. :P
« Last Edit: May 27, 2011, 06:13:39 pm by Runer112 »