Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

console input function for rhino?

How do I accept a variable from the console with javascript in Rhino? anything similar to cin or scanf?

like image 379
mihsathe Avatar asked Dec 22 '10 11:12

mihsathe


People also ask

How do you input in rhino?

Just use the Java class library. I think this will work: var stdin = java.lang.System.in; var line = stdin. readLine();

Is Rhino a JavaScript engine?

Rhino is a JavaScript engine written fully in Java and managed by the Mozilla Foundation as open source software.


1 Answers

Here's two lines that'll do what you want:

var stdin = new BufferedReader( new InputStreamReader(System['in']) )
var aLine = stdin.readLine();
like image 84
B T Avatar answered Sep 21 '22 18:09

B T