Jump to content

» «

Using of For

1 reply to this topic
  • inan.ahammad

    Project Props Modder

  • Members
  • Joined: 15 Jul 2016
  • Bangladesh


Posted 4 weeks ago

Hello guys i got a big problem with for tag.I read many books bu couldnt understand....Can anyone give an example of for in a prigram and tell me in details about its uasge..Thanks it would be much helpful.

  • trip


  • Andolini Mafia Family
  • Joined: 10 Oct 2007
  • United-States
  • Contribution Award [GTAF]
    Contribution Award [Gen Chat]
    Contribution Award [GTAF Census]
    Doggo-Chop Winner 2016


Posted 4 weeks ago

For is a loop the will run for a set number of times.

For (int x; x <=10; x++)
//code between these brackets will run 10 times.  And each time you can read the value of x if needed.
A while loop will need a condition to be met before it leaves it s code block.
Random myRandom;
While (myRandom!=10)
//code between the brackets will run foreber until the value of myRandom=10.  

IMO loops and conditions are the core of "programming". Once you understand loops and conditions you can pretty much code in any language.

1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users