为什么“提示”对于输入字符串很重要?

时间:2016-08-15 22:42:51

标签: string matlab if-statement

我只是在为字符串编写一个简单的if else测试。我曾试图通过使用

来实现它
str = input("input: ")

通常我不必使用提示,提示我应该养成一直使用的习惯吗?还是只需要使用字符串? 我知道这是一个基本问题,我发现很难绕过去。 提前谢谢!

#If testing is entered the program will return true, anything else will 
#return false

prompt = ("input: ")
str = input(prompt,"s");
answer = ("testing");
test = strcmp(str,answer);
if test = 1;
  disp("true")
else
  disp("false")
end

0 个答案:

没有答案