環/教程/獲取輸入
外觀
< 環
我們可以使用以下方法從鍵盤獲取輸入
- 給出命令
- GetChar() 函式
- Input() 函式
語法
Give VariableName示例
See "Enter the first number : " Give nNum1
See "Enter the second number : " Give nNum2
See "Sum : " + ( 0 + nNum1 + nNum2 )輸出
Enter the first number : 3
Enter the second number : 4
Sum : 7我們可以使用 GetChar() 函式從標準輸入獲取一個字元
語法
GetChar() ---> Character示例
While True
See "
Main Menu
(1) Say Hello
(2) Exit
"
Option = GetChar()
GetChar() GetChar() # End of line
# the previous two lines can be replaced with the next line
# Give Option
if Option = 1
see "Enter your name : " give cName
see "Hello " + cName
else
bye
ok
End我們可以使用 Input() 函式從鍵盤獲取輸入
語法
Input(nCount) ---> string該函式將等待直到讀取到至少 nCount 個字元
示例
See "Enter message (30 characters) : " cMsg = input(30)
See "Message : " + cMsg