# Reverse a switch statement

**URL:** https://forum.kirupa.com/t/reverse-a-switch-statement/194603
**Category:** Uncategorized
**Created:** [July 24, 2006, 9:51pm UTC](https://forum.kirupa.com/t/reverse-a-switch-statement/194603 "2006-07-24T21:51:44Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![brndn](https://avatars.discourse-cdn.com/v4/letter/b/dec6dc/32.png) [@brndn](https://forum.kirupa.com/u/brndn)
#### Post date: [July 24, 2006, 9:51pm UTC](https://forum.kirupa.com/t/reverse-a-switch-statement/194603/1 "2006-07-24T21:51:44Z")

</div>

Hi does anybody know how to cycle backwards through cases in a switch statement.

based on it relative position??

```auto

var state=0;

nextB.onRelease=function(){
    switch(state)
    {
        case 0:
        state=1;
        _root.text_field="blahblah.";
        break;
        
        case 1:
        state=2;
        _root.text_field="blahblah";
        break;
    }
}

```

not sure if this can be done?

brndn
