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.

Can somebody please eli5 "sanitizing input" for me with a Java exemplar

Featured Replies

The tutorial I am following says that:

"Post-test loops will execute at least ONE TIME - This is useful for sanitizing input"

 

I have no idea what this means. Help please!

7 minutes ago, Noidlox said:

The tutorial I am following says that:

"Post-test loops will execute at least ONE TIME - This is useful for sanitizing input"

 

I have no idea what this means. Help please!

An example of a post-test loop would be a do while loop.

For example:

do {
    // some stuff
} while(some condition is true); // check this after

The contents of this loop will execute at least once, because the condition is checked after the loop completes NOT before.

This is different from a while loop where the condition is checked first:

while (some condition is true) { // Check this first
  // some stuff
}

An example use of this is sanitizing input because you may want to get some input from the user THEN check it, and only exit the loop if some condition is matched.

Consider this trivial example:

Scanner scanner = new Scanner(System.in);
String input;
do {
    input = scanner.nextLine(); // Read a line of input
} while (!input.equals("Hello")); // Only exit the loop if the input matches "Hello"

 

Edited by Explv

4 minutes ago, Explv said:

An example of a post-test loop would be a do while loop.

For example:


do {
    // some stuff
} while(some condition is true); // check this after

The contents of this loop will execute at least once, because the condition is checked after the loop completes NOT before.

This is different from a while loop where the condition is checked first:


while (some condition is true) { // Check this first
  // some stuff
}

An example use of this is sanitizing input because you may want to get some input from the user THEN check it, and only exit the loop if some condition is matched.

Consider this trivial example:


Scanner scanner = new Scanner(System.in);
String input;
do {
    input = scanner.nextLine(); // Read a line of input
} while (!input.equals("Hello")); // Only exit the loop if the input matches "Hello"

 

Makes sense. Thank you!

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.