Ad
  • Default User Avatar

    erhm, did you not notice the top solution? ;)

  • Default User Avatar

    I know this is 17 months old, but thank you for this! I actually didnt know you could remove the else and just add another return for "Odd".

  • Custom User Avatar

    The Func part is a delegate and the (x) => ... part is a lambda expresion but I don't know the advantage of using them here.

  • Custom User Avatar

    if its not too much to ask what is Func<int,string> and the => part

  • Custom User Avatar

    i just wanted to say that i personally drop the else statement when the if statement contains a return statement since it will exit the method.

  • Default User Avatar

    As g964 says in your post below, you are missing a using statement - add using System; above everything else in your solution. Math is short for System.Math in C#, but you need the initial using statement for this to work.

    Alternatively you could replace Math with System.Math everywhere in your solution.

  • Custom User Avatar

    using C#
    i am getting this error. code work fine on Visual studion on my local machine.
    i googled it but it seems to be something concerning namespaces but i cant pin it down.
    any ideas?
    src/Solution.cs(11,28): error CS0103: The name 'Math' does not exist in the current context

  • Default User Avatar

    Please before posting issues look at the top of the page: 4975 people passed the C# kata so you could have seen that it's not an issue of the kata but a problem of your code. To use Math.Pow you need "using System;".

  • Custom User Avatar

    it gave me an error while using c#
    it didnt recognize Math.Pow()
    solution worked on my local machine just fine

  • Custom User Avatar
  • Custom User Avatar

    or just return a in the else sa=tatement as i did

  • Custom User Avatar

    In that case a == b, so it's indifferent which of them is returned. In the current case b will be returned, but the condition could be a >= b as well in which case a would be returned when the are equal.

  • Custom User Avatar

    then either one is ok

  • Custom User Avatar

    what if numbers were equal?