Skip to content

Instantly share code, notes, and snippets.

@SparkySimp
Created October 6, 2022 08:32
Show Gist options
  • Save SparkySimp/a40df2f22c8016833afdccfc58817d44 to your computer and use it in GitHub Desktop.
Save SparkySimp/a40df2f22c8016833afdccfc58817d44 to your computer and use it in GitHub Desktop.
IntegerExtension.cs for NTP_100622_01
public static class IntegerExtensions
{
/// <summary>
/// Determines wheter an integer is odd or not.
/// </summary>
/// <param name="n">The number to test</param>
/// <returns>Wheter n is odd or not</returns>
public static bool IsOdd(this int n) => n % 2 != 0;
/// <summary>
/// Determines wheter an integer is even or not.
/// </summary>
/// <param name="n">The number to test</param>
/// <returns>Wheter n is even or not</returns>
public static bool IsEven(this int n) => n % 2 == 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment