Jump to content

simple IF problem: parentheses ?


wilsonf1

Recommended Posts

trying to do this to determine with image to show:If (fs.FileExists("e:\domains\t\websitename.com\user\htdocs\"& folder_section &"\"& page_folder &"\logo.jpg"))=true Then Replace(text,"{logo_path}","logo") Else Replace(text,"{logo_path}","../../images/image_coming_soon") End Ifbut i getCannot use parentheses when calling a Sub/backoffice/build.asp, line 54Replace(text,"{logo_path}","logo")--------------------------------^HELP!!!!!

Link to comment
Share on other sites

Yeah, VB is wonderful, isn't it? I get this all the time, I've never done the research to determine what the difference between a "function" and a "sub" is, but I write functions starting with the word "function" and get the error about subs, so VB has it's own little thing going on. This is the correct syntax:

If (fs.FileExists("e:\domains\t\websitename.com\user\htdocs\"& folder_section &"\"& page_folder &"\logo.jpg"))=true ThenReplace text,"{logo_path}","logo"ElseReplace text,"{logo_path}","../../images/image_coming_soon"End If

All you need to do is remove the parens and give the list of parameters just as a comma-separated list.

Link to comment
Share on other sites

Yeah, VB is wonderful, isn't it? I get this all the time, I've never done the research to determine what the difference between a "function" and a "sub" is
A function returns a value, a sub (or sub procedure) doesn't. A sub is equivalent to a void function in any other language.I don't know why it throws a fit about putting parentheses around subs, that's just one of a number of ASP gotchas that worked itself into the language.
Link to comment
Share on other sites

A function returns a value, a sub (or sub procedure) doesn't. A sub is equivalent to a void function in any other language.
Technically there is no difference between the two, it is a retarded design decision that VB makes a distinction and requires different syntax, and someone deserves to get kicked in the crotch several times for making that decision. That's just my opinion, I could be wrong..
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...