Page 1 sur 1

Recognition of assume(s,DOM_STRING);

Publié : ven. sept. 07, 2018 10:34 pm
par compsystems
Hello, although there is the InputStr command to capture a string type data, for example with spaces, I think that the INPUT command could also act similarly if the variable is predefined as a string


EXAMPLE 1

Code : Tout sélectionner

InputStr("Enter a string",s);
print("s="+s);
If the user enters 1 2 3
print
1 2 3 // ok

EXAMPLE 2

Code : Tout sélectionner

input("Enter a string",s);
print("s="+s);
If the user enters 1 2 3
syntax error // ok

EXAMPLE 3

Code : Tout sélectionner

assume(s,DOM_STRING);
input("Enter a string",s);
print("s="+s);
should not return syntax error, because the expected type is a string

Re: Recognition of assume(s,DOM_STRING);

Publié : sam. sept. 08, 2018 5:58 am
par parisse
input does not check anything on the previous content of variables, it just overwrites. Like := or assume. And I don't see why it would be better to run 2 commands (assume+input) instead of 1 (InputStr).