kadaj kadaj - 23 days ago 9
ASP.NET (C#) Question

What is the purpose of the iop statement and can I get the same output without it?

I have a following function written in vbscript that I am trying to understand and port. I am not sure why the statements

iop = iop - 100
and
iop = iop + 100
are required. Can I remove those and get the same output?
iop
is not used anywhere else.

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


So can I write the above as snippet as

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


I am a vbscript/asp newbie. Thanks.

Answer Source

Apparently they are not required anymore. As you thought, it's safe to remove all those iop assignments except the first one.