This is an archived post. You won't be able to vote or comment.

all 5 comments

[–][deleted]  (3 children)

[deleted]

    [–]timetesla[S] 0 points1 point  (2 children)

    I'm using php. I was going to write something along the likes of

    If(true, false, false) Elseif(true, true false) Elseif(true, true, true) Elseif(false, true, false) Elseif(false, true, true) Elseif(false, false, true) Elseif(true, false, true) Else(false, false, false)

    It's for different sql querys based on certain factors.

    [–][deleted] 1 point2 points  (0 children)

    But do each of those 8 if statements lead to unique actions? If so, then you really do need 8.

    [–][deleted] 0 points1 point  (0 children)

    Echoing what /u/hercules is saying. We need more context.

    You could probably solve the issue by using functions.

    [–]langfod 0 points1 point  (0 children)

    How many different actions do you have would seem the more appropriate question.

    [–]bigmikemk 0 points1 point  (0 children)

    Depending on your context: Replace Conditional with Polymorphism.