prompts the user for keyboard input
x = input(message) x = input(message, "string")
character string: the inline prompting message. Extended UTF-8 characters are supported.
optional flag, to return the input as is, as a literal string in
x.
"string":
x = evstr(keyboard_input)x = keyboard_inputx = input(message)
message on a new line;keyboard_input of any
length, + enter. keyboard_input must be a valid Scilab expression
provided on the current line, without continuation mark ...
keyboard_input can include extended UTF-8 characters.x = evstr(k_input) :
x is output.keyboard_input is empty or made of blanks, x is set to
[].
x = input(message, "string") always sets
x to the literal keyboard_input
considered as a string, possibly empty "".
maxIter = input("Max number of iterations: ") // enter 300 δ = 1e-6; tol = input("Tolerance: ") // enter nothing or blanks tol = input("Tolerance: ") // enter 7*δ f = input("Function: "); // enter sin f == sin f(5) s = "ABC"; r = input("Expression: ") // enter s + "D" res = input("Invalid expression: ") // enter s/4 | ![]() | ![]() |
--> maxIter = input("Max number of iterations: ") // enter 300
Max number of iterations: 300
maxIter =
300.
--> δ = 1e-6;
--> tol = input("Tolerance: ") // | = caret before enter
Tolerance: |
tol =
[]
--> tol = input("Tolerance: ") // enter 7*δ
Tolerance: 7*δ
tol =
0.000007
--> f = input("Function: "); // enter sin
Function: sin
--> f == sin
ans =
T
--> f(5)
ans =
-0.9589243
--> s = "ABC";
--> r = input("Expression: ") // enter s + "D"
Expression: s + "D"
r =
"ABCD"
--> res = input("Invalid expression: ") // enter s/4
Invalid expression: s / 4
Undefined operation for the given operands.
check or define function %c_r_s for overloading.
Invalid expression:
The "string" option returns the input string as is,
with leading and trailing white spaces. Extended characters are accepted:
--> x = input("Prénom (surname): ","string") // | = caret before enter
Prénom (surname): André |
x =
" André "
| Version | Description |
| 6.0.0 | In case where nothing is entered with the "string" option, input returns an empty string instead of a space. |