Board index » Visual Studio » function refresher

function refresher

Visual Studio190
How can I call a function in an if statement to test it's return value..



function test1()

if test2() = false then

msgbox("")

else

msgbox("else")

end if

end function



function test2(x)

if x>100 then

test2 = false

end if

end function



Is that right?


-
 

Re:function refresher

Dave wrote on 11 jun 2004 in microsoft.public.scripting.vbscript:



Quote
How can I call a function in an if statement to test it's return

value..



function test1()

if test2() = false then

msgbox("")

else

msgbox("else")

end if

end function



function test2(x)

if x>100 then

test2 = false

end if

end function



Is that right?





test1( 101 )

test1( 100 )



function test1(z)

if not test2(z) then ''you forgot the parameter

msgbox("parameter greater than 100")

else

msgbox("parameter less than or equal to 100")

end if

end function



function test2(x)

if x>100 then

test2 = false

else

test2 = true '' The result is not true by default

end if

end function





--

Evertjan.

The Netherlands.

(Please change the x'es to dots in my emailaddress)

-

Re:function refresher

Evertjan. wrote:



Quote
Dave wrote on 11 jun 2004 in microsoft.public.scripting.vbscript:





>How can I call a function in an if statement to test it's return

>value..

>

>function test1()

>if test2() = false then

>msgbox("")

>else

>msgbox("else")

>end if

>end function

>

>function test2(x)

>if x>100 then

>test2 = false

>end if

>end function

>

>Is that right?

>





test1( 101 )

test1( 100 )



function test1(z)

if not test2(z) then ''you forgot the parameter

msgbox("parameter greater than 100")

else

msgbox("parameter less than or equal to 100")

end if

end function



function test2(x)

if x>100 then

test2 = false

else

test2 = true '' The result is not true by default

end if

end function





;) tx

-