if the last line in the script is pname '' then it will run automagically on load.
----- Original Message ----- From: Ray Zhao <[email protected]> To: [email protected] Cc: Sent: Sunday, April 6, 2014 9:23:47 AM Subject: [Jprogramming] Need help on "super simple" keyboard input. After learning J really slowly for the past little while, I realized that it was probably because all the examples had to do with array manipulation, which was cool, but even though I was able to do reversals and ravels and stuff, I still wasn't able to make a program that can ask for the user's name. Yesterday, I found out that on Chapter 28 of Learning J (wow, all the way back there) there was a snippet similar to this: put =: (1!:2) & 2 pname =: 3 : 0 put 'What is your name?' name=.(1!:1) 1 'Your name is ', name ) When I first tried to code that, I didn't put that prompt into a function and it seemed to skip the input. The second time, I put the line pname '' under the function and it said syntax error, but when the program is run and one types pname '', it THEN works. Is there a way to code this so that when the program is run, the first thing that shows up is "What is your name?" and the program waits for the user to input without having to run the program first and type something like pname ''? ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
