mul*_*lla 1 vbscript qtp adsutil.vbs
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
Run Code Online (Sandbox Code Playgroud)
情况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
Run Code Online (Sandbox Code Playgroud)
情况3:在操作过程中作为字符串和显式转换为数字
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
Run Code Online (Sandbox Code Playgroud)
我需要一个不同行为的逻辑原因.但在其他语言中,它是直截了当的,并将按预期工作
| 归档时间: |
|
| 查看次数: |
97 次 |
| 最近记录: |