We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I'm teaching a high school computer science class, using Processing. I see the print and println functions for console output, but don't see the corresponding input functions. Where is readln or its equivalent?
Processing's IDE's console doesn't accept keyboard input! :| We gotta compile the sketch w/ CTRL+E and run directly from console: :-B
// forum.processing.org/two/discussion/7205/ // how-do-i-perform-console-input // stackoverflow.com/questions/4644415/ // java-how-to-get-input-from-system-console // docs.oracle.com/javase/8/docs/api/java/util/Scanner.html import java.util.Scanner; String name; byte age; Scanner in = new Scanner(System.in); println("Type in your name..."); name = in.nextLine(); println("Type in your age..."); age = in.nextByte(); in.close(); println("\nName: \t" + name); println("Age: \t" + age); exit();
Alternatively, the standard way of getting user input in Processing is to use keyPressed() and similar functions.
Answers
Processing's IDE's console doesn't accept keyboard input! :|
We gotta compile the sketch w/ CTRL+E and run directly from console: :-B
Alternatively, the standard way of getting user input in Processing is to use keyPressed() and similar functions.