Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2003
    Posts
    14

    Unanswered: Find the mistake

    This is the small piece of code.
    I am beginner, kindly tell me where is the problem
    It is the code to add series of numbers from 'strt' variable to 'stp' variable.


    <%@language=vbscript%>
    <%option explicit%>
    <html>
    <body>
    <%
    dim strt,stp,sum

    function series(strt,stp)
    dim i,sum
    sum=0
    for i=strt to stp
    sum=sum+i
    next
    end function
    sum=series(1,10)
    Response.Write(sum)


    %>
    </body>
    </html>

  2. #2
    Join Date
    Oct 2003
    Location
    Montreal
    Posts
    2
    There is one line of code missing in your function, se the code below the line is between *and* then everything works fine Ciao

    <%@ language=vbscript%>
    <%option explicit%>
    <%
    dim strt,stp,sum

    function series(strt,stp)

    dim i,sum

    sum=0

    for i=strt to stp
    sum=sum+i
    next
    *series=sum*
    end function

    %>
    <html>
    <body>
    <%sum=series(1,10)

    Response.Write("La somme est de : " & sum)%>
    </body></html>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •