Spyke
perchance·Perchance - Create a Random Text GeneratorbyAshenthorn

Radio buttons and outputting NULL?

I'm working on a very simple t2i generator with simple radio button input for creating a prompt (choose an accessory).

Almost everything is working as expected, but I'm not sure if I'm doing it the best way.

I have an accessory list, and can output any of the accessories correctly... but I want NULL (wearing NO accessories) to be included if "Random" is chosen.

I'm sure there is something simple that I'm missing or maybe there's a better way to do this?

Thanks for any help!

Radio buttons and outputting NULL?https://perchance.org/0nk49ulineOpen linkView original on lemmy.world

There are many ways, one simple is to use .replace("and wearing random", ""), so when the random is selected, "wearing random" will be replaced by an empty string "" (nothing). you put it in wAcc in the prompt, like: wAcc.replace("and wearing random", "")

3

Thanks so much for the reply!

I never would have thought of this solution, and it will probly do the job. 👍 I was hoping for something a little more portable.. like somehow setting a null value list item, or maybe a better if/else for the list item output.

1

You reached the end

Radio buttons and outputting NULL? | Spyke