[Question]
  [
# Do While False
At work today one of my colleagues was describing the use-case for do while(false). The person he was talking to thought that
this was silly and that simple if statements would be much better. We then proceeded to waste half of our day discussing the best
manner to write something equivalent to:
```
do
{
   //some code that should always execute...
   if ( condition )
   {
      //do some stuff
      break;
   }
   //some code that should execute if condition is not true
   if ( condition2 )
   {
       //do some more stuff
       break;
   }
   //further code that should not execute if condition or condition2 are true
}
while(false);
```
This is an idiom which is found in c quite often.
Your program should produce the same output as the below pseudo-code depending on the conditions.
```
do
{
   result += "A";
   if ( C1)
   {
      result += "B";
      break;
   }
   result += "C"
   if ( C2 )
   {
       result += "D";
       break;
   }
   result += "E";
}
while(false);
print(result);
```
Therefore the input could be:
```
1. C1 = true, C2 = true
2. C1 = true, C2 = false
3. C1 = false, C2 = true
4. C1 = false, C2 = false
```
and the output should be:
```
1. "AB"
2. "AB"
3. "ACD"
4. "ACE"
```
This is code-golf so answers will be judged on bytes.
Standard loopholes are banned.
Yes this is a simple one, but hopefully we will see some creative answers, I'm hoping the simplicity will encourage people to use languages they are less confident with.
  
[Answer]
# Python 3, 31
Saved 1 byte thanks to xnor.
Only one byte away from ES6. :/ Stupid Python and its long anonymous function syntax.
Hooray for one liners!
```
lambda x,y:x*"AB"or"AC"+"ED"[y]
```
Test cases:
```
assert f(1, 1) == "AB"
assert f(1, 0) == "AB"
assert f(0, 1) == "ACD"
assert f(0, 0) == "ACE"
```
[Answer]
# JavaScript ES6, ~~30~~ ~~26~~ 25 bytes
A simple anonymous function taking two inputs. Assign to a variable to call.
**Update**: Let's jump on the index bandwagon. It saves 4 bytes. *I have secured my lead over Python*. Saved a byte by currying the function; call like `(...)(a)(b)`. Thanks Patrick Roberts!
```
a=>b=>a?"AB":"AC"+"ED"[b]
```
Old, original version, 30 bytes (included to not melt into the python answer `(;`):
```
(a,b)=>"A"+(a?"B":b?"CD":"CE")
```
[Answer]
# C preprocessor macro, 34
* 1 byte saved thanks to @TobySpeight
```
#define f(a,b)a?"AB":b?"ACD":"ACE"
```
[Try it online](https://tio.run/##ZY9NbsMgEIX3PsWIqJJJaIqzjJNU/ckpUi/IGBKkFleAu2jksztj2XUdhQXwzXvMPPDxhNi2s1Ib6zSYVIkjV8/s5ZWtj3S8vbM17XvWzqzDz7rUsAmxtNXyvEsgsS7Cl7IO0u6m/AkF4Fl5mM8JfjhcEqDViTYnfwch@hrjoPQaZvmUVj01EHWIqIIOhwK244tLJiBrxITkP8kbTXZa3@xvvKk8paV2MgcLGwj2V1cmHUdxeLqrHWTByb1Y8DHEt6eoJmUP4cMxAVOzLZZIoW4LK86HXw05vI61d5Qiador).
[Answer]
## Haskell, 28 bytes
```
x#y|x="AB"|y="ACD"|1<2="ACE"
```
Usage example: `False # True` -> `"ACD"`.
Using the input values directly as guards.
[Answer]
# [MATL](https://esolangs.org/wiki/MATL), 15 ~~17~~ bytes
```
?'AB'}'AC'69i-h
```
Inputs are `0` or `1` on separate lines. Alternatively, `0` can be replaced by `F` (MATL's `false`) and `1` by `T` (MATL's `true`).
[**Try it online!**](http://matl.tryitonline.net/#code=PydBQid9J0FDJzY5aS1o&input=MAowCg)
```
?           % if C1 (implicit input)
  'AB'      %   push 'AB'
}           % else
  'AC'      %   push 'AC'
  69        %   push 69 ('E')
  i-        %   subtract input. If 1 gives 'D', if 0 leaves 'E'
  h         %   concatenate horizontally
            % end if (implicit)
```
[Answer]
## Brainfuck, 65 bytes
This assumes that C1 and C2 are input as raw 0 or 1 bytes. e.g. 
```
echo -en '\x00\x01' | bf foo.bf
```
Golfed:
```
++++++++[>++++++++<-]>+.+>+>,[<-<.>>-]<[<+.+>>,[<-<.>>-]<[<+.>-]]
```
Ungolfed:
```
                                      Tape
                                      _0
++++++++[>++++++++<-]>+.+  print A    0 _B
>+>,                       read C1    0 B 1 _0  or  0 B 1 _1
[<-<.>>-]<                 print B    0 B _0 0  or  0 B _1 0
[<+.+>>                    print C    0 D 1 _0
    ,                      read C2    0 D 1 _0  or  0 D 1 _1
    [<-<.>>-]<             print D    0 D _0 0  or  0 D _1 0
    [<+.>-]                print E    0 D _0    or  0 E _0
]
```
I believe it worth noting that this solution *is* in fact based on breaking out of while loops.
[Answer]
# GNU Sed, 21
```
/^1/cAB
/1$/cACD
cACE
```
[Ideone](https://ideone.com/2GUPrv).
[Answer]
# [NTFJ](https://github.com/ConorOBrien-Foxx/NTFJ/), 110 bytes
```
##~~~~~#@|########@|~#~~~~~#@*(~#~~~~#~@*########@^)~#~~~~##@*##~~~~~#@|########@|(~#~~~#~~@*):~||(~#~~~#~#@*)
```
More readable:
```
##~~~~~#@|########@|~#~~~~~#@*(~#~~~~#~@*########@^)~#~~~~##@*##~~~~~#@|########@|(~#~~~#~~@*
):~||(~#~~~#~#@*)
```
That was certainly entertaining. [Try it out here](http://conorobrien-foxx.github.io/NTFJ/), using two characters (`0` or `1`) as input.
Using ETHProduction's method for converting to 0, 1 (characters) to bits, this becomes simpler.
```
##~~~~~#@|########@|
```
This is the said method. Pushing 193 (`##~~~~~#@`), NANDing it (`|`) with the top input value (in this case, the first char code, a 48 or 49). This yields 254 for 1 and 255 for 0. NANDing it with 255 (`########@`) yields a 0 or 1 bit according to the input.
```
~#~~~~~#@*
```
This prints an `A`, since all input begins with `A`. `*` pops the `A` when printing, so the stack is unchanged from its previous state.
```
(~#~~~~#~@*########@^)
```
Case 1: the first bit is `1`, and `(` activates the code inside. `~#~~~~#~@*` prints `B`, and `########@^` pushes 255 and jumps to that position in the code. This being the end of the program, it terminates.
Case 2: the first bit is `0`. `(` skips to `)` and the code continues.
```
~#~~~~##@*
```
This prints a `C`, because that's the next character.
```
##~~~~~#@|########@|
```
This converts our second input to a bit.
```
(~#~~~#~~@*)
```
If our second bit is a 1, we proceed to print an `E`.
```
:~||
```
This is the NAND representation of the Boolean negation of our bit: `A NAND (0 NAND A) = NOT A`.
```
(~#~~~#~#@*)
```
This now activates if the bit was a `0`, and prints `E`.
[Answer]
# Pyth, 16 bytes
```
+\A?Q\B+\C?E\D\E
```
[Test suite](https://pyth.herokuapp.com/?code=%2B%5CA%3FQ%5CB%2B%5CC%3FE%5CD%5CE&test_suite=1&test_suite_input=1%0A1%0A1%0A0%0A0%0A1%0A0%0A0&debug=0&input_size=2)
Ternaries!
Explanation:
```
+\A              Start with an A
?Q\B             If the first variable is true, add a B and break.
+\C              Otherwise, add a C and
?E\D             If the second variable is true, add a D and break.
\E               Otherwise, add a E and finish.
```
Input on two consecutive lines.
[Answer]
# CJam, 15 ~~16~~ ~~17~~ bytes
```
'Ali'B'C'Eli-+?
```
[**Try it online!**](http://cjam.tryitonline.net/#code=J0FsaSdCJ0MnRWxpLSs_&input=MAox)
*One byte off thanks to @randomra, and one byte off thanks to @Dennis*
Explanation:
```
'A                  e# push "A"
  li                e# read first input as an integer
    'B              e# push "B" 
      'C            e# push "C"
        'E          e# push "E"
          li-       e# leave "E" or change to "D" according to second input
             +      e# concatenate "C" with "E" or "D"
              ?     e# select "B" or "C..." according to first input
```
---
Old version (16 bytes):
```
'Ali'B{'C'Eli-}?
```
Explanation:
```
'A                  e# push character "A"
               ?    e# if-then-else
  li                e# read first input as an integer. Condition for if
    'B              e# push character "B" if first input is true
      {       }     e# execute this if first input is false
       'C           e# push character "C"
         'E         e# push character "E"
           li       e# read second input as an integer
             -      e# subtract: transform "E" to "D" if second input is true
                    e# implicitly display stack contents
```
[Answer]
## Pyth, 13 chars, 19 bytes
```
.HC@"૎્««"iQ2
```
Takes input in form [a,b]
Explanation
```
               - autoassign Q = eval(input())
           iQ2 -    from_base(Q, 2) - convert to an int
   @"૎્««"    -   "૎્««"[^]
  C            -  ord(^)
.H             - hex(^)
```
[Try it here](http://pyth.herokuapp.com/?code=.HC%40%22%E0%AB%8E%E0%AB%8D%C2%AB%C2%AB%22iQ2&input=%5B0%2C1%5D&debug=0)
[Or use a test suite](http://pyth.herokuapp.com/?code=.HC%40%22%E0%AB%8E%E0%AB%8D%C2%AB%C2%AB%22iQ2&input=%5B0%2C1%5D&test_suite=1&test_suite_input=%5B0%2C0%5D%0A%5B0%2C1%5D%0A%5B1%2C0%5D%0A%5B1%2C1%5D&debug=0)
[Answer]
# C, 76 bytes
I renamed `c1` to `c`, `c2` to `C` and `result` to `r`. C programmers go to extremes to avoid `goto`. If you ever have a problum with absurd syntax in C, it is most likely to be because you did not use `goto`.
```
char r[4]="A";if(c){r[1]=66;goto e;}r[1]=67;if(C){r[2]=68;goto e;}r[2]=69;e:
```
### Ungolfed
```
char r[4] = "A";
if(c1){
    r[1] = 'B';
    goto end;
}
r[1] = 'C';
if(c2){
    r[2] = 'D';
    goto end;
}
r[2] = 'E';
end:
```
[Answer]
## C, 41 bytes
I'm not sure if the question requires a program, a function or a code snippet.  
Here's a function:
```
f(a,b){a=a?16961:4473665|b<<16;puts(&a);}
```
It gets the input in two parameters, which must be 0 or 1 (well, `b` must), and prints to stdout.
Sets `a` to one of `0x4241`, `0x454341` or `0x444341`. When printed as a string, on a little-endian ASCII system, gives the required output.
[Answer]
# [R](https://www.r-project.org/), ~~41~~ ~~39~~ 37 bytes
```
pryr::f(c("ACD","ACE","AB")[1+a+a^b])
```
[Try it online!](https://tio.run/##K/qfZvu/oKiyyMoqTSNZQ8nR2UVJB0i6gkgnJc1oQ@1E7cS4pFjN/2kaIUGhrjoKIFKTC8Zzc/QJBnPBDIQslAuR/g8A "R – Try It Online")
In R, `TRUE` and `FALSE` are coerced to `1` and `0` respectively when you attempt to use them as numbers. We can convert these numbers to indices `1`, `2`, and `3` through the formula `1+a+a^b`.
```
  a  |   b  | 1+a+a^b
TRUE | TRUE | 1+1+1^1 = 3
TRUE | FALSE| 1+1+1^0 = 3
FALSE| TRUE | 1+0+0^1 = 1
FALSE| FALSE| 1+0+0^0 = 2
```
These values are then used to index the list `ACD`, `ACE`, `AB` to yield the correct output.
Saved two bytes thanks to JayCe.
If instead you prefer a version with an `if` statement, there's the following for 41 bytes:
```
pryr::f(`if`(a,"AB",`if`(b,"ACD","ACE")))
```
[Try it online!](https://tio.run/##K/qfZvu/oKiyyMoqTSMhMy1BI1FHydFJSQfMTgKynV2UQKSrkqam5v80jZCgUFcdBRCpyQXjuTn6BIO5YAZCFsqFSP8HAA "R – Try It Online")
[Answer]
# Mathematica, ~~35~~ 30 bytes
```
If[#,"AB",If[#2,"ACD","ACE"]]&
```
Very simple. Anonymous function.
[Answer]
## Retina, 22 bytes
```
1.+
AB
.+1
ACD
.+0
ACE
```
[Try it Online](http://retina.tryitonline.net/#code=MS4rCkFCCi4rMQpBQ0QKLiswCkFDRQ&input=MSAxCjEgMAowIDEKMCAw)
[Answer]
# JavaScript, 38 bytes
Use no-delimiter `0` or `1` instead of `false`/`true`
```
_=>"ACE ACD AB AB".split` `[+('0b'+_)]
```
[Answer]
## [**Caché ObjectScript**](http://docs.intersystems.com/cache20152/csp/docbook/DocBook.UI.Page.cls?KEY=GCOS), 27 bytes
```
"A"_$s(x:"B",y:"CD",1:"CE")
```
[Answer]
# [ArnoldC](http://mapmeld.github.io/ArnoldC/), 423 bytes
```
IT'S SHOWTIME
HEY CHRISTMAS TREE a
YOU SET US UP 0
HEY CHRISTMAS TREE b
YOU SET US UP 0
BECAUSE I'M GOING TO SAY PLEASE a
BECAUSE I'M GOING TO SAY PLEASE b
TALK TO THE HAND "ABD"
BULLSHIT
TALK TO THE HAND "ABE"
YOU HAVE NO RESPECT FOR LOGIC
BULLSHIT
BECAUSE I'M GOING TO SAY PLEASE b
TALK TO THE HAND "ACD"
BULLSHIT
TALK TO THE HAND "ACE"
YOU HAVE NO RESPECT FOR LOGIC
YOU HAVE NO RESPECT FOR LOGIC
YOU HAVE BEEN TERMINATED
```
Since ArnoldC doesn't seem to have formal input, just change the first 2 `YOU SET US UP` values to either 0 or 1 instead.
# Explanation
This is just a whole bunch of conditional statements which account for all the possible outputs. Why, you may ask? Well, ArnoldC doesn't really have string comprehension. It can't even concatenate strings! As a result, we have to resort to the more... inefficient... method.
[Answer]
# Java, 28 bytes
Same boilerplate as a lot of the answers. type is `BiFunction<Boolean,Boolean, String>`.
```
(c,d)->c?"AB":d?"ACD":"ACE"
```
[Answer]
# Pyth, 21 bytes
```
@c"ACE ACD AB AB"diz2
```
[Try it here!](http://pyth.herokuapp.com/?code=%40c%22ACE+ACD+AB+AB%22diz2&input=00&test_suite=1&test_suite_input=11%0A10%0A01%0A00&debug=0)
Input is taken as 0 or 1 instead of true/false while C1 comes first.
## Explanation
Just using the fact that there are only 4 possible results. Works by interpreting the input as binary, converting it to base 10 and using this to choose the right result from the lookup string.
```
@c"ACE ACD AB AB"diz2   # z= input
                  iz2   # Convert binary input to base 10
 c"ACE ACD AB AB"d      # Split string at spaces
@                       # Get the element at the index
```
[Answer]
# [Y](https://github.com/ConorOBrien-Foxx/Y/), 20 bytes
In the event that the first input is one, only one input is taken. I assume that this behaviour is allowed. [Try it here!](http://conorobrien-foxx.github.io/Y/)
```
'B'AjhMr$'C'E@j-#rCp
```
Ungolfed:
```
'B'A jh M
   r$ 'C 'E@ j - # r
 C p
```
Explained:
```
'B'A
```
This pushes the characters `B` then `A` to the stack.
```
jh M
```
This takes one input, increments it, pops it and moves over that number of sections.
Case 1: `j1 = 0`. This is the more interesting one. `r$` reverses the stack and pops a value, `'C'E` pushes characters `C` and `E`. `@` converts `E` to its numeric counterpart, subtracts the second input from it, and reconverts it to a character. `r` un-reverses the stack. Then, the program sees the C-link and moves to the next link `p`, and prints the stack.
Case 2: the program moves to the last link `p`, which merely prints the entire stack.
[Answer]
## PowerShell, 40 bytes
```
param($x,$y)(("ACE","ACD")[$y],"AB")[$x]
```
Nested arrays indexed by input. In PowerShell, `$true` / `1` and `$false` / `0` are practically equivalent (thanks to very loose typecasting), so that indexes nicely into a two-element array. This is really as close to a ternary as PowerShell gets, and I've used it plenty of times in golfing.
### Examples
```
PS C:\Tools\Scripts\golfing> .\do-while-false.ps1 1 1
AB
PS C:\Tools\Scripts\golfing> .\do-while-false.ps1 1 0
AB
PS C:\Tools\Scripts\golfing> .\do-while-false.ps1 0 1
ACD
PS C:\Tools\Scripts\golfing> .\do-while-false.ps1 0 0
ACE
```
[Answer]
# K, 37 bytes
```
{?"ABCDE"@0,x,(1*x),(2*~x),(~x)*3+~y}
```
[Answer]
# [Vitsy](https://github.com/VTCAKAVSMoACE/Vitsy), 26 bytes
Expects inputs as 1s or 0s through STDIN with a newline separating.
```
W([1m;]'DCA'W(Zr1+rZ
'BA'Z
```
~~I actually discovered a serious problem with if statements during this challenge. D: This is posted with the broken version, but it works just fine. (I'll update this after I fix the problem)~~ Please note that I have updated Vitsy with a fix of if/ifnot. This change does not grant me any advantage, only clarification.
Explanation:
```
W([1m;]'DCA'W(Zr1+rZ
W                      Get one line from STDIN (evaluate it, if possible)
 ([1m;]                If not zero, go to the first index of lines of code (next line)
                       and then end execution.
       'DCA'           Push character literals "ACD" to the stack.
            W          Get another (the second) line from STDIN.
             (         If not zero, 
do the next instruction.
              Z        Output all of the stack.
               r1+r    Reverse the stack, add one (will error out on input 0, 1), reverse.
                   Z   Output everything in the stack.
'BA'Z
'BA'                   Push character literals "AB" to the stack.
    Z                  Output everything in the stack.
```
[Try it Online!](http://vitsy.tryitonline.net/#code=VyhbMW07XSdEQ0EnVyhacjErcloKJ0JBJ1o&input=MAow)
[Answer]
# Jelly, 14 bytes
```
Ḥoị“ACD“AB“ACE
```
This expects the Booleans (**1** or **0**) as separate command-line arguments. [Try it online!](http://jelly.tryitonline.net/#code=4bikb-G7i-KAnEFDROKAnEFC4oCcQUNF&input=&args=MQ+MQ)
### How it works
```
Ḥoị“ACD“AB“ACE  Main link. Left input: C1. Right input: C2.
Ḥ               Double C1. Yields 2 or 0.
 o              Logical OR with C2.
                2o1 and 2o0 yield 2. 0o1 and 0o0 yield 1 and 0, resp.
   “ACD“AB“ACE  Yield ['ACD', 'AB', 'ACE'].
  ị             Retrieve the string at the corresponding index.
```
[Answer]
# [beeswax](http://esolangs.org/wiki/Beeswax), 26 bytes
Interpreting `0` as false, `1` as true.
```
E`<
D`d"`C`~<
_T~T~`A`"b`B
```
Output:
```
julia> beeswax("codegolfdowhile.bswx",0,0.0,Int(20000))
i1
i1
AB
Program finished!
julia> beeswax("codegolfdowhile.bswx",0,0.0,Int(20000))
i1
i0
AB
Program finished!
julia> beeswax("codegolfdowhile.bswx",0,0.0,Int(20000))
i0
i1
ACD
Program finished!
julia> beeswax("codegolfdowhile.bswx",0,0.0,Int(20000))
i0
i0
ACE
Program finished!
```
Clone my beeswax interpreter from [my Github repository](https://github.com/m-lohmann/BeeswaxEsolang.jl).
[Answer]
# C, ~~47~~ 45 bytes
Since there are only 3 different outcomes, we can pick one of three strings like this:
```
char*f(c,d){return"AB\0 ACE\0ACD"+(!c<<d+2);}
```
Thanks to [Herman L](/users/70894) for 2 bytes
## Demo
```
#include<stdio.h>
int main()
{
    printf("%s\n%s\n%s\n%s\n",
           f(1,1),
           f(1,0),
           f(0,1),
           f(0,0));
}
```
[Answer]
## Perl, 23 bytes
```
say<>>0?AB:<>>0?ACD:ACE
```
Requires the `-E`|`-M5.010` flag and takes input as 1 and 0:
```
$ perl -E'say<>>0?AB:<>>0?ACD:ACE' <<< $'0\n0'
ACE
$ perl -E'say<>>0?AB:<>>0?ACD:ACE' <<< $'0\n1'
ACD
$ perl -E'say<>>0?AB:<>>0?ACD:ACE' <<< $'1\n0'
AB
```
Alternative solution that requires `-p` and is 22 + 1 = 23 bytes:
```
$_=/^1/?AB:/1/?ACD:ACE
```
```
perl -pe'$_=/^1/?AB:/1/?ACD:ACE' <<< '0 1'
```
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), ~~23~~ 20 bytes
Code:
```
Ii"AB"?q}"AC"?69I-ç?
```
[Try it online!](http://05ab1e.tryitonline.net/#code=SWkiQUIiP3F9IkFDIj82OUktw6c_&input=MQow)
]