【发布时间】:2016-11-23 10:16:55
【问题描述】:
vbscript下面的值是什么
1)x=1+"1"
2)x="1"+"1"
3)x=1+"mulla"
注意:在以上三种情况下,我使用第一个变量作为字符串或整数,第二个变量一如既往地作为字符串。
案例1:在操作过程中充当数字并自动转换为数字
enter code here
y=inputbox("Enter a numeric value","") Rem I am using 1 as input
x=1
msgbox x+y Rem value is 2
msgbox x*y Rem value is 1
案例2:作为字符串,在操作过程中不转换为数字失败
enter code here
y=inputbox("Enter a numeric value","") Rem I am using 1 as input
x=1
if y= x then
msgbox "pass"
else
msgbox "fail"
end if
案例3:作为String,在操作过程中显式转换为numeric
enter code here
y=inputbox("Enter a numeric value","") Rem I am using 1 as input
x=1
if Cint(y) = x then
msgbox "pass"
else
msgbox "fail"
end if
我需要不同行为的逻辑原因。但在其他语言中它是直截了当的,并且会按预期工作
【问题讨论】:
标签: vbscript qtp adsutil.vbs