Hi Duane,

 

Why do you say <% if x = 1 then call mysubroutine(24) %> is not allowed?
I've been using it for years! :-)

 

You can use the if statement exactly as you would in VB, or most other
languages. So:-

 

Sub WriteDouble(intInput)

      Dim sTemp

      sTemp = "The double of " & intInput & " is " & (intInput * 2)

      response.write sTemp

End function

 

If x = 1 then

      Call WriteDouble(5)

Elseif x = 2 then

      Call WriteDouble(10)

Else

      Call WriteDouble(20)

End if

 

Dan

 

________________________________

From: dw_ygrps [mailto:[EMAIL PROTECTED] 
Sent: 21 January 2005 04:03
To: [email protected]
Subject: [AspClassicAnyQuestionIsOk] Re: A simple question: branching
based on IF statement

 


Thank you Charles for your response.
I did not know about the learnasp.com site and thanks for turning me 
on to it.  Perhaps it was right in front of me, but I did not see any 
examples of subroutines being called from an IF statement.

I believe it is illegal to do a CALL to subroutine from an IF 
statement.  i.e. <% if x = 1 then call mysubroutine(24) %>
The above example is is not allowed.
It looks like IF statements are limited to variable manipulations and 
response.write etc functions, but not to branching to functions or 
subs.  

If there is an example of this in the learnasp.com site, I would love 
to see it.

Thanks again,
Duane


--- In [email protected], Charles Carroll 
<[EMAIL PROTECTED]> wrote:
> Read
> http://www.learnasp.com/learn/qualitycode.asp
> particularly all teh entries with the word SUBroutine. All will be 
clear.
> 
> http://www.learnasp.com/learn/subdictionary.asp
> and
> http://www.learnasp.com/learn/subreusable.asp
> and
> http://www.learnasp.com/learn/rsfast.asp
> may particularly open your mind to a world of possibilities.
> 
> 
> On Wed, 19 Jan 2005 04:00:01 -0000, dw_ygrps <[EMAIL PROTECTED]> wrote:
> > 
> > 
> > In ASP VBscript, there does not appear to be a legal way to 
branch to
> > a function or sub on the same asp page.
> > 
> > I know how to use server.transfer to build a web page out of 
selected
> > parts from small building-block asp files, but in traditional VB
> > there are goto statements etc that allow you to jump to a 
subroutine
> > and back etc.
> > 
> > For example:
> > If myvariable = 1 then gosub subroutine_25
> > 
> > What is the asp vbscript command that would do this?
> > 
> > Thanks,
> > Duane
> > 
> > 
> > Yahoo! Groups Links
> > 
> > 
> > 
> > 
> >






________________________________

Yahoo! Groups Links

*       To visit your group on the web, go to:
        http://groups.yahoo.com/group/AspClassicAnyQuestionIsOk/
          
*       To unsubscribe from this group, send an email to:
        [EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]
subscribe> 
          
*       Your use of Yahoo! Groups is subject to the Yahoo! Terms of
Service <http://docs.yahoo.com/info/terms/> . 



[Non-text portions of this message have been removed]



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/AspClassicAnyQuestionIsOk/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to