Nim by Example

Nim is a powerful statically typed language that allows the programmer expressiveness without compromising run-time performance. As a general purpose programming language, it gives the same sort of power and performance as C++, but in a nicer package and with even more powerful tools!

Getting started? Head over to the installation instructions!

import tables, strutils

var wordFrequencies = initCountTable[string]()

for line in stdin.lines:
  for word in line.split(", "):

echo "The most frequent word is '", wordFrequencies.largest, "'"

The example above waits on standard input. To use it, type in multiple words and then press Ctrl+D in your terminal.