# How do you choose what class you add to a list with a variable?

**URL:** <https://discourse.processing.org/t/how-do-you-choose-what-class-you-add-to-a-list-with-a-variable/22987>\
**Category:** Coding Questions\
**Created:** [August 2, 2020, 1:02pm UTC](https://discourse.processing.org/t/how-do-you-choose-what-class-you-add-to-a-list-with-a-variable/22987 "2020-08-02T13:02:31Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![no\_spaces](https://avatars.discourse-cdn.com/v4/letter/n/f04885/32.png) [@no\_spaces](https://discourse.processing.org/u/no_spaces)\
**Post date:** [August 2, 2020, 4:21pm UTC](https://discourse.processing.org/t/how-do-you-choose-what-class-you-add-to-a-list-with-a-variable/22987/4 "2020-08-02T16:21:32Z")

</div>

@GoToLoop This is a valid answer, (I had thought of this myself) but I want to avoid having a big switch statement. My question was kind of vague, but to clarify I have a lot of classes, and don’t want to do this, but I will if I have to.

---

_[View the full topic](https://discourse.processing.org/t/how-do-you-choose-what-class-you-add-to-a-list-with-a-variable/22987)._
