I’m trying to set up some algorithms for a programmer.
Let me give you an example and tell me how one can program it:
-
If
a = 1 ;give statement" 123 " -
if
b = 1 ;give statement" 234 " -
If
c = 1 ;give statement" 345 " -
If
a, b, c /= 1, do nothing. -
If
a and b = 1 ;give statement" 123 + 234 "
How do I set up the algorithm so that, when two factors are true, for example
in the case above when both a and b are 1, only " 123 + 234" is shown and will not
give me : 123, 234, 123 + 234.
Does this make sense?
Please do not give me your answer in code, but just simple layman’s term so I can understand it.
I think you’re just after the
if ... else if .... else if ...construct.Also, to keep the code clean, start with the most specific cases:
If a and b = 1 ; give statement ” 123 + 234 “
ELSE if a = 1 ; give statement ” 123 “
ELSE if b = 1 ; give statement ” 234 “
ELSE If c = 1 ; give statement ” 345 “
ELSE If a, b, c /= 1, do nothing.
(Last line you can obviously skip!)