Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Documentation @IF Function

Jun
528
3
The documentation for the @IF function specifies the syntax

@IF[condition,string1,string2]

It seems that the following syntax also works.

@IF[condition,string1]

The third argument is not just blank; it is absent. Is this something that we can count on? If so, it would be nice of the documentation included it.
 
It would be useful if you want to return something only when the condition is true. Likewise, you can leave string1 empty to return something only when the condition is false.

Now, leaving both string1 and string2 empty really would be pointless. Legal, but pointless.
 
But IMO that syntax is pointless and can be done more easily without the @IF. Why do you think it's something desirable?

I am forming a string with variable content, as in

set cmdline=sendhtml ... "%[addr]%@if["%bccaddr" NE "", bcc:%bccaddr]"

It's true that in a batch file I could use IFF and alternate commands, but the code above is straightforward. In the past, I always included the final comma to make an empty third field. I was just asking if the third argument could be omitted.

Based on your answer, I would suggest adding that information to the help file.
 

Similar threads

Back
Top