Sha256: 3af770df4788c83b187aeb7f316a2e5ec2b1a5e8b2eefd0f1d0699ae62a55d25
Contents?: true
Size: 736 Bytes
Versions: 101
Compression:
Stored size: 736 Bytes
Contents
public static class Bob { public static string Response(string statement) { if (IsSilence(statement)) return "Fine. Be that way!"; if (IsYelling(statement)) return "Whoa, chill out!"; if (IsQuestion(statement)) return "Sure."; return "Whatever."; } private static bool IsSilence (string statement) { return statement.Trim() == ""; } private static bool IsYelling (string statement) { return statement.ToUpper() == statement && System.Text.RegularExpressions.Regex.IsMatch(statement, "[a-zA-Z]+"); } private static bool IsQuestion (string statement) { return statement.Trim().EndsWith("?"); } }
Version data entries
101 entries across 101 versions & 1 rubygems