Fix non-compiling code

This commit is contained in:
flaviut 2014-07-17 12:24:22 -04:00
commit d812b28505

View file

@ -11,18 +11,18 @@ Getting started? Head over to the [installation instructions](/getting_started/)
``` nimrod ``` nimrod
import tables, strutils import tables, strutils
var wordFrequencies = initTable[string, int] var wordFrequencies = initTable[string, int]()
for line in stdin.lines: for line in stdin.lines:
for word in line.split(", "): for word in line.split(", "):
wordFrequencies[word] += 1 wordFrequencies[word] = wordFrequencies[word] + 1
var maxFrequency = 0 var maxFrequency = 0
var mostFrequentWord: string var mostFrequentWord: string
for word, frequency in wordFrequencies: for word, frequency in wordFrequencies:
if frequency > maxFrequency: if frequency > maxFrequency:
maxFrequency = frequency maxFrequency = frequency
mostFrequentWord = word mostFrequentWord = word
echo "The most frequent word is '", word, "'" echo "The most frequent word is '", mostFrequentWord, "'"
``` ```