In fact, if you put an "End IF" after something like this:
If rstemp("SomeNumber")="1" then Response.write "Some Message 1"
I THINK you would get an error message.
Main Topics
Browse All TopicsI have the following code that works without the end if statements. Why does it work without it, and should I have it in anyway? It's in the middle of a different loop.
If rstemp("SomeNumber")="1" then Response.write "Some Message 1"
If rstemp("SomeNumber")="2" then Response.write "Some Message 2"
If rstemp("SomeNumber")="3" then Response.write "Some Message 3"
If rstemp("SomeNumber")="4" then Response.write "Some Message 3"
If rstemp("SomeNumber")="5" then Response.write "Some Message 5"
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
I'm with old man fritz, end if is our friend, so is tabbing your formating. It's not just pretty, it helps narrow down errors and makes it easier for other programmers to read your code.
If you're intent on making big bunches of single line code, you can always use the EXECUTE function in ASP. Lots of fun there:
str = "IF 1>0 THEN:RESPONSE.WRITE ""WOOHOO LOGIC IS WORTHLESS!"":ELSE:RESPONSE
execute(str)
: (colon) is the same as a real carrage return.
-Coolhand2120
Fritz is the all knowing oracle
Oops! I wrote:
If something then : 'your code ; end if
Instead of:
If something then : 'your code : end if
>>Fritz is the all knowing oracle<<
Hardly! Many people don't know this, but I learned ASP here. My first question? http://www.experts-exchang
;-)
FtB
Business Accounts
Answer for Membership
by: leewPosted on 2005-04-27 at 09:50:23ID: 13878183
End if is not necessary if your "then" instructions are on the same line:
For example - NOT Necessary:
If rstemp("SomeNumber")="1" then Response.write "Some Message 1"
For example - NECESSARY:
If rstemp("SomeNumber")="1" then
Response.write "Some Message 1"
End If