#Why is it recommended to not use selection operator in code? it seems convenient

30 messages · Page 1 of 1 (latest)

opal fern
#

question

lavish pebbleBOT
#

This post has been reserved for your question.

Hey @opal fern! Please use /close or the Close Post button above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

vague helm
#

Well it's not "not-recommended." It's just a matter of fact of whether you're using it appropriately. Switch statements are a lot faster than if/else statements, but it is often used for conditions where it's not appropriate; hence it's not suggested to beginners.

If you understand what you're doing and can use them appropriately, go for it. (An example of proper switch use is a boolean or switching states of something). If you do decide to use selection statements, be sure to avoid using it on objects. Cheers!

undone iris
vague helm
#

if/else provides more clarity, and is introduced way earlier than switch no matter what OOP language you use. I wouldn't say switch statements are complex, but they're definitely more confusing to use "properly," when you first work with them. It still will work, just might cause a memory leak here or there since Java has terrible memory management 🤷 This isn't Rust lol

lavish pebbleBOT
#

💤 Post marked as dormant

This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.

opal fern
opal fern
#

(im struggling hard asf)

vague helm
vague helm
vague helm
# lavish pebble

You can close the ticket here and thank me if this has been helpful :)

opal fern
#

i think i’ll be okay

#

im mostly struggling with like setting it up and compiling it on my computer

#

i alr installed rustup im just having some trouble understanding packages and how to use them

#

its not like compiling java at all java is ez

vague helm
#

Well ofc it's hard if you don't have any prior knowledge of C++ or Haskell?

opal fern
#

not the syntax or concepts

vague helm
opal fern
#

just compiling

#

like the main new thing is memory management

#

and i understand that fine

vague helm
#

ok

vague helm
#

You are very cool for using Rust. Just want to assure you, you are dope :)

opal fern
#

ty

lavish pebbleBOT
# lavish pebble

Before your post will be closed, would you like to express your gratitude to any of the people who helped you? When you're done, click I'm done here. Close this post!.