Results 1 to 10 of 40

Thread: To learn how to script.

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Street Boss John's Avatar
    Join Date
    Jun 2013
    Location
    Lebanon
    Posts
    825
    Quote Originally Posted by bobo View Post
    You use while and do...while for conditional looping (you don't know how many times you have to loop). You use switch when you wanna compare 1 variable to a bunch of values (could also be done with a bunch of if...else if). You use break if you want to exit a loop early (I usually put those with a condition). You use return; when you want to exit a function early. I could give you java syntax, but you probably don't want that.
    He doesn't really need do{}, I even doubt anyone uses it on graal anyways: (if it works)
    PHP Code:
    do {
      echo(
    temp.i);
      
    temp.i++;
    } while (
    temp.<=5); 
    -Johnaudi

  2. #2
    Quote Originally Posted by John View Post
    He doesn't really need do{}, I even doubt anyone uses it on graal anyways: (if it works)
    PHP Code:
    do {
      echo(
    temp.i);
      
    temp.i++;
    } while (
    temp.<=5); 
    I like using do...while when I wanna make a loop but don't know the condition at the beginning. So I'll put a do{, put the stuff in, then figure out the condition on the end.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •