Jump to content

Repetition and Looping


Drewyboyo

Recommended Posts

  On 1/23/2017 at 4:48 PM, Solution said:

for (int k = 0; k < 10; K++)

isnt that exactly whats in my spoiler doge.png

can't there be some silly "loop x" function doge.png

  On 1/23/2017 at 4:49 PM, Eagle Scripts said:

Instead of declaring k above it, you could actually declare it in the loop itself as:

 

 

for(int i = 0; i <= 10; i++){

     // do stuff

}

thank ya

Link to comment
Share on other sites

  On 1/23/2017 at 4:50 PM, Drewyboyo said:

isnt that exactly whats in my spoiler doge.png

can't there be some silly "loop x" function doge.png

thank ya

Nah you can create the int inside the for condition instead of above, same difference tho.

a for loop is a loop x 

for (int index = 0; index < 10; index++) {

//do stuff

}

 

Will loop 10 times.

  • Like 1
Link to comment
Share on other sites

Who needs loops wen u can just switch it up

int k= getWCExp(); //get ur wc exp cuz u need it

switch (k) {
    case 1: checkWCexp();break;
    case 2: checkWCexp();break;
    case 3: checkWCexp();break;
    case 4: checkWCexp();break;
    case 5: checkWCexp();break;
    case 6: checkWCexp();break;
    case 7: checkWCexp();break;
    case 8: checkWCexp();break;
    case 9: checkWCexp();break;
    case 10: checkWCexp();break;
    default: checkWCexp();break;
}

np

Edited by Hayase
  • Like 1
Link to comment
Share on other sites

  Reveal hidden contents
  On 1/23/2017 at 5:37 PM, Hayase said:

Who needs loops wen u can just switch it up

int k= getWCExp(); //get ur wc exp cuz u need it

(switch k) {
    case 1: checkWCexp();break;
    case 2: checkWCexp();break;
    case 3: checkWCexp();break;
    case 4: checkWCexp();break;
    case 5: checkWCexp();break;
    case 6: checkWCexp();break;
    case 7: checkWCexp();break;
    case 8: checkWCexp();break;
    case 9: checkWCexp();break;
    case 10: checkWCexp();break;
    default: checkWCexp();break;
}

np

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...