2017-09-24 33 views
2

我有一个用vbscript编写的函数,我试图理解和移植。我不知道为什么要求陈述iop = iop - 100iop = iop + 100。我可以删除这些并获得相同的输出吗? iop没有在其他地方使用。iop声明的目的是什么?没有它,我可以得到相同的输出吗?

function IsMobile(byref op) 
    IsMobile = false 
    if op <> empty then 
     if InStr(1, op, ",") < 1 then 

      on error resume next 
      Dim iop 
      iop = CLng(op) 
      if err then 
       err.Clear 
       exit function 
      end if 
      on error goto 0 

      if iop >= 100 and iop < 200 then 
       iop = iop - 100 
       IsMobile = true 
      elseif iop <= -100 and iop > -200 then 
       iop = iop + 100 
       IsMobile = true 
      elseif iop = 3 or iop = -3 then 
       IsMobile = IsMobileBrowser() 
      end if 
     end if 
    end if 
end function 

所以,我可以写上面片断的

if iop >= 100 and iop < 200 then 
    IsMobile = true 
elseif iop <= -100 and iop > -200 then 
    IsMobile = true 
elseif iop = 3 or iop = -3 then 
    IsMobile = IsMobileBrowser() 
end if 

我是一个VBScript/ASP新手。谢谢。

回答

2

显然他们不再需要。如您所想,除第一个外,可安全删除所有这些iop作业。

相关问题