Search code examples
c#unity-game-enginemathoperator-precedence

How do you use order of operations in programming?


Is there a good way to use order of operation in programming? How could you write this equation in code for example? x = 2(100 - 50)


Solution

  • You must be overthinking it :)

    var x = 2 * (100 - 50);
    

    As said in the comments, the best way to learn is often to try it out for yourself!