Write it using ifs first.
Then write it using ternary.
Then write it using something else.
Then another way. Open two editors side by side and compare for your idea of elegance. If you cant write it but one way then that is what you do. Its as basic as it gets sl significant speed gains between all versions are highly unlikely.