Ad
Code
Diff
  • Module Kumite
        Public Function Min(array() As Single) As Single
            Return array.Min()
        End Function
    End Module 
    • Imports NUnit.Framework
    • Module Test
    • public function MinF(x, n)
    • dim min as integer
    • dim i as integer
    • min = x(0)
    • for i = 1 to n
    • if x(i) < min then
    • min = x(i)
    • end if
    • next
    • return min
    • end function
    • Module Kumite
    • Public Function Min(array() As Single) As Single
    • Return array.Min()
    • End Function
    • End Module

For large numbers, use long. A and b should be Int32/ int

  • The built in long type looks sexier and is used more
  • A and b should be 32 so we dont go out of range
  • Need to type cast one of the ints so that it does long addition and not integer addition which would return and overflow
  • Can be static so should be static
  • Arrow functions are grim but thats just my opinion

🙌

Code
Diff
  • public static class Sum
    {
       public static long GetSum(int a, int b)
       {
         return (long)a + b;
       }
    }
    • using System;
    • public class Sum
    • public static class Sum
    • {
    • public Int64 GetSum(Int64 a, Int64 b) => a + b;
    • public static long GetSum(int a, int b)
    • {
    • return (long)a + b;
    • }
    • }

Hello World

A method that returns "Hello World".

Module Kumite
    Function HelloWorld()
        return "Hello World"
    End Function
End Module