In Ruby, you can create a one-liner function to check if a sentence is a pangram and make it case-insensitive using the following code:
main.rb89 chars4 lines
This function uses a range from 'a' to 'z' to iterate over all the letters of the alphabet. It checks if each letter is present in the given sentence after converting it to lowercase using downcase
. The all?
method ensures that all the characters are present in the sentence, making it a pangram.
gistlibby LogSnag