Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • $\begingroup$ This answer need the solution, though the OP did not show how they used the result.. $\endgroup$ Commented Jan 5, 2024 at 11:37
  • $\begingroup$ @kelalaka I may offer a solution if OP tell us what language they're using. I would assume C, but even then, I need to know what type each variables are. $\endgroup$ Commented Jan 5, 2024 at 11:39
  • $\begingroup$ We have a common solution for the if/else independent of the language, the real problem what they do with the result.. $\endgroup$ Commented Jan 5, 2024 at 11:45
  • $\begingroup$ @DannyNiu I'm using Rust for the same. Both results are assigned to an x and y variable in both branches. $\endgroup$ Commented Jan 5, 2024 at 13:13
  • $\begingroup$ Then you may separate the condition and use 2:1 multiplexer as stated in the if/else $\endgroup$ Commented Jan 5, 2024 at 13:21