# "Case" Statements

**URL:** <https://forum.kirupa.com/t/case-statements/3819>\
**Category:** programming\
**Created:** [September 8, 2001, 1:48am UTC](https://forum.kirupa.com/t/case-statements/3819 "2001-09-08T01:48:58Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 8, 2001, 1:48am UTC](https://forum.kirupa.com/t/case-statements/3819/1 "2001-09-08T01:48:58Z")

</div>

I’m working on a bunch of buttons that do different things depending on what the user has clicked before. Does anyone know if Case exists in Flash like it does in C++, or should I just use else If else If (and so on)?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 8, 2001, 2:53am UTC](https://forum.kirupa.com/t/case-statements/3819/2 "2001-09-08T02:53:17Z")

</div>

Can you explain what case statements do in C++?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 8, 2001, 3:14am UTC](https://forum.kirupa.com/t/case-statements/3819/3 "2001-09-08T03:14:46Z")

</div>

why don’t you just give each button some on (release) event?

cases are also called switch statements. different things take place depending on the user’s input  
say i had 5 things i could do, a case would look like this:  
//this is C++ now…  
switch (choice)  
{  
case 1:  
cout \<\< “Do this” \<\< endl;  
break;  
case 2:  
cout \<\< “Do this here” \<\< endl;  
break;  
case 3:  
cout \<\< “What am i doing?” \<\< endl;  
break;  
case 4:  
cout \<\< “???” \<\< endl;  
break;  
case 5:  
cout \<\< “Finally, done!” \<\< endl;  
break;  
default:  
cout \<\< “Not a valid answer” \<\< endl;  
break;}

see? it takes variable “choice” and it’s value is tested here. if it’s equal to 4, it would output “???”, 5, “Finally, done!”, etc.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 8, 2001, 5:14am UTC](https://forum.kirupa.com/t/case-statements/3819/4 "2001-09-08T05:14:53Z")

</div>

Sounds like it would be pretty easy to emulate that in flash… simple functions/arrays/user imput calculations.

It would take some amount of scripting… but mostly basic commands… not anything too indepth.
