I seem to be having trouble using a conditional OR statement in my code.
Hopefully someone can point out my error.
In one of my controllers I have the following statement:
if @thisVar == (0||1||6)
But this won’t work. Instead, I end up having to do this:
if @thisVar == 0
elsif @thisVar == 1
elsif @thisVar == 6
Which is of course, redundant code, since the same “dosomething” gets
typed 3 times.
I have had this same problem in .rhtml code, when I use something like:
<% if @thisVar == (0||1||6) %><%= dosomething %><% end %>
In looking at the Ruby documentation for conditional statements, I have
seen code like this with the explanation that it works. What am I doing
Pilgrim IT, LLC
1 Short Street
Northampton, MA 01060
1815 Brownsboro Road
Louisville, KY 40206
NOTICE: This email and any attachments are intended only for the
addressee and may contain information that is confidential and/or
legally privileged. If you are not the intended recipient or have
received this email in error, please notify the sender by return email
or by calling 866-434-4976. You should then delete the message and any
attachments or copies. If you are not the intended recipient, you are
prohibited from retaining, distributing, disclosing or using any
information contained herein.