我目前正在學習Rebol。Rebol命令行的基本輸入
在我知道,我可以在命令行中讀取輸入其他語言,比如Java中:
Scanner sc = new Scanner(System.in)
sc.nextLine();
在C#
Console.ReadLine();
在C
scanf("%s", s);
我想知道如何在Rebol中完成同樣的事情。
我目前正在學習Rebol。Rebol命令行的基本輸入
在我知道,我可以在命令行中讀取輸入其他語言,比如Java中:
Scanner sc = new Scanner(System.in)
sc.nextLine();
在C#
Console.ReadLine();
在C
scanf("%s", s);
我想知道如何在Rebol中完成同樣的事情。
您可以使用input
命令在控制檯要求輸入。
>> name: input
Joe
== "Joe"
的ask
功能通過要求輸入之前打印字符串補充input
:
age: ask "How old are you? "
它也有一個/hide
細化隱瞞輸入:
pass: ask/hide "Enter your password: "
這時,/hide是Rebol 3 alphas中的not implemented
一個較長的答案(至少對於中等水平)將包括監視system/ports/input
端口(您可以使用source input
來完成這個操作) - 這可以用於輸入不是源於控制檯(如shell,CGI)。
採購輸入還可以讓你弄清楚如何管理單鍵按壓(對於文本菜單很有用,它不會強制你按下輸入...人們仍然知道文本菜單是什麼嗎?;-) 。 – moliad 2013-02-28 12:04:27