If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > Find the mistake

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-01-03, 13:38
Pranav.Agg Pranav.Agg is offline
Registered User
 
Join Date: Sep 2003
Posts: 14
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>
Reply With Quote
  #2 (permalink)  
Old 10-01-03, 14:22
Jac_T Jac_T is offline
Registered User
 
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>
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On