Jump to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Repetition and Looping

Featured Replies

How many ways can you write something to loop? We're writing a fixed repetition for graphics like,

int k;
for (k = 1; k <=10; k++)

Any cleaner ways to write this?

Or something less monotonous?feels.png

  • Author

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

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

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.

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

  • Author

import java.awt.*;
import java.applet.*;


public class Lab07Bst extends Applet
{
public void paint(Graphics g)
{
// Draw Grid
Expo.drawLine(g,250,0,250,650);
Expo.drawLine(g,500,0,500,650);
Expo.drawLine(g,750,0,750,650);
Expo.drawLine(g,0,325,1000,325);

int x1, y1, x2, y2, x, y, r;

// Draw Red Horizontal Lines
Expo.setColor(g,Expo.red);
x1 = 0;
y1 = 5;
x2 = 250;
y2 = 5;
for (int k = 1; k <= 32; k++)
{
Expo.drawLine(g,x1,y1,x2,y2);
y1 += 10;
y2 += 10;
}

int x3, y3, x4, y4;
// Draw Blue Vertical Lines
Expo.setColor(g,Expo.blue);
x3 = 255;
y3 = 0;
x4 = 255;
y4 = 325;
for (int t = 1; t <= 25; t++)
{
Expo.drawLine(g,x3,y3,x4,y4);
x3 += 10;
x4 += 10;
}


int x5, y5;
// Draw Black Diagonal Dots
Expo.setColor(g,Expo.black);
x5 = 510;
y5 = 280;
for (int u = 1; u <= 24; u++)
{
Expo.drawPoint(g,x5,y5);
x5 += 10;
y5 += -10;
}



int x6, y6, z6;
// Draw Green Concentric Circles
Expo.setColor(g,Expo.green);
x6 = 887;
y6 = 170;
z6 = 10;
for (int i = 1; i <= 12; i++)
{
Expo.drawCircle(g,x6,y6,z6);
z6 += 10;
}






// Draw Purple Concentric Ovals
int x7, y7, z7, h7;
Expo.setColor(g,Expo.purple);
x7 = 125;
y7 = 480;
z7 = 5;
h7 = 10;
for (int i = 1; i <= 20; i++)
{
Expo.drawOval(g,x7,y7,z7,h7);
z7 += 4;
h7 += 6;
}




// Draw Pink Concentric Arcs
int x8, y8, z8, h8, g8, i8;
Expo.setColor(g,Expo.pink);
x8 = 260;
y8 = 650;
z8 = 5;
h8 = 15;
i8 = 0;
g8 = 90;
for (int i2 = 1; i2 <= 19; i2++)
{
Expo.drawArc(g,x8,y8,z8,h8,i8,g8);
z8 += 12;
h8 += 16;
}






// Draw Brown Concentric Rectangles





// Draw Gold Sphere


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

 

If you're into this kinda stuff

IntStream.range(0, 10).forEach(i -> System.out.println("Loop " + i));
  • Author

 

If you're into this kinda stuff

IntStream.range(0, 10).forEach(i -> System.out.println("Loop " + i));

wheres frost godwards aio instead of replying to my starter java class help boge.png

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.