[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

Using If / then /else

Posted on 2003-03-12
3
Medium Priority
?
216 Views
Last Modified: 2010-04-15
I'm trying to impliment some code.  There are two chunks that are duplicates except for a few pieces in each. I need to set up an if statement to get it to work but because I have the same "Dim" on both chunks of code. I was getting the name is being redefined error.

Is there a proper way to use the if statement I was using this

<% If cstr(requestform("whatisit")) = cstr("server")  Then


buch of code here

else If cstr(requestform("whatisit")) = cstr("standalone")  Then


more code here


end if
end if

0
Comment
Question by:gpyper
3 Comments
 
LVL 46

Accepted Solution

by:
Kent Olsen earned 500 total points
ID: 8120066
Of course, C doesn't use "then" and "endif".  :)  Here are a couple of forms of nested "if"s.


if (condition-1)
{
}
else if (condition-2)
{
}
else if (condition-3)
{
}
etc....

if (condition-1)
{
  if (condition-2)
  {
  }
  else
  {
  }
else if (condition-3)
{
}
else if (condition-4)
{
  if (condition-5)
  {
  }
}


All of the above are valid.

Kdo
0
 
LVL 6

Expert Comment

by:gj62
ID: 8120080
put the Dim outside the If statement.

BTW - this seems more like VB than C...
0
 

Author Comment

by:gpyper
ID: 8120451
Doh ... posted to the wrong bloody section.... free points
0

Featured Post

Live webcast with Pinal Dave

Pinal Dave will teach you tricks to help identify the real root cause of database problems rather than red herrings. Attendees will learn scripts that they can use in their environment to immediately figure out their performance Blame Shifters and fix them quickly.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

An Outlet in Cocoa is a persistent reference to a GUI control; it connects a property (a variable) to a control.  For example, it is common to create an Outlet for the text field GUI control and change the text that appears in this field via that Ou…
There's never been a better time to become a computer scientist. Employment growth in the field is expected to reach 22% overall by 2020, and if you want to get in on the action, it’s a good idea to think about at least minoring in computer science …
The goal of this video is to provide viewers with basic examples to understand how to use strings and some functions related to them in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use switch statements in the C programming language.
Suggested Courses

640 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question