Skip to main content
1 of 2
JimmyHu
  • 5.5k
  • 2
  • 10
  • 40

Review

It seems that you are trying to make a simple calculator with number comparison in C#. There are some problems in this implementation.

ToInt32:

Do you expect the input of calculation is always in int format? How about floating numbers?

Nah method:

  • Naming:

    I have no idea how's the name Nah imply the operation in the method. Something like run or perform are better than Nah.

  • Integer Division:

    Notice that the execution of 3 / 2 in this implementation is 1. It is a kind of integer division. Is the integer division result the correct output you expected?

  • MessageBox.Show Part:

    In C# 6, you can use string interpolation and make MessageBox.Show("Sum of thenumbers entered is: " + (a + b)); into MessageBox.Show($"Sum of thenumbers entered is: {(a + b)}");. Interpolated strings are useful in string displaying and it's commonly used with Console.WriteLine or MessageBox.Show.

JimmyHu
  • 5.5k
  • 2
  • 10
  • 40