Created
February 28, 2013 20:04
-
-
Save ninjapanzer/5059655 to your computer and use it in GitHub Desktop.
A toy that sums up a string
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class WordCounters | |
def self.count_up_word word | |
count = 0 | |
word.each_char do |l| | |
count = l.ord + count | |
end | |
count | |
end | |
end | |
puts WordCounters.count_up_word("pAul") | |
puts WordCounters.count_up_word("cOol") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment