Proposed exercise
Create a function that tells if a character is alphabetic (A through Z) or not. It should be used like this:
if (IsAlphabetic ('a'))
System.Console.WriteLine ("It is an alphabetic character");
(Note: do not worry about accents and ñ)
Output
Solution
using System;
public class FunctionIsAlpha
{
public static bool IsAlpha(char simbolo)
{
if (simbolo >= 'a') && (simbolo <= 'z')
return true;
if (simbolo >= 'A') && (simbolo <= 'Z')
return true;
return false;
}
public static void Main()
{
Console.WriteLine( IsAlpha('a') );
}
}