filmov
tv
Nim Programming Language Introduction and Basics

Показать описание
Nim is a pretty cool programming language. It's statically typed and compiled, making it great for building server applications or user interfaces. It has a clean syntax without the clutter of a bunch of symbols and needless abstractions.
This simplicity is beneficial, especially in a time when code often becomes obsolete and needs to be rewritten. Nim does an excellent job maintaining clarity. Notice how it borrows some good traits from Python, such as using indentation to establish the scope of parameters.
But it doesn't rely too heavily on indentation that it prevents us from having a clear birds-eye view of the code. There is also a neat feature in Nim. A number symbol is used to indicate comments. I like this because it saves you from typing many characters.
Although, technically, you make two keystrokes for this (a shift and the number sign). Nim's syntax is very minimalistic, like Python. This is apparent in its use of the command 'echo', which takes fewer keystrokes than 'print'.
Also, Nim allows us to start our strings with 'FMT', which can help us effectively format our output. Let's discuss Nim's iterators next. They might seem daunting at first, but the for-loop, the if statement, and the yield statement make it easy to see what's going on.
For example, the iterator will filter out all the odd numbers from the array it takes, which is straightforward. Nim's if-else and case-switch statements look almost identical to Python's, with the exception of how it declares a variable. Moreover, the language also has built-in ternaries, which can include multi-line expressions.
Nim's mathematical operations include common functions such as square roots, rounding, and checking if a number is a power of two. It also has a neat feature called 'almost equals', which comes handy while comparing two values that might not exactly be equal but are approximately the same. Lastly, let's talk about Nim's string operators.
We can join or find index in the string, count the frequency of characters, remove white spaces, parse numerical value from strings, and even unindent them. Although there are some features of Nim that I find a bit confusing, such as the 'collect new sequence', I must admit that the overall readability of the code in this language is impressive.
This simplicity is beneficial, especially in a time when code often becomes obsolete and needs to be rewritten. Nim does an excellent job maintaining clarity. Notice how it borrows some good traits from Python, such as using indentation to establish the scope of parameters.
But it doesn't rely too heavily on indentation that it prevents us from having a clear birds-eye view of the code. There is also a neat feature in Nim. A number symbol is used to indicate comments. I like this because it saves you from typing many characters.
Although, technically, you make two keystrokes for this (a shift and the number sign). Nim's syntax is very minimalistic, like Python. This is apparent in its use of the command 'echo', which takes fewer keystrokes than 'print'.
Also, Nim allows us to start our strings with 'FMT', which can help us effectively format our output. Let's discuss Nim's iterators next. They might seem daunting at first, but the for-loop, the if statement, and the yield statement make it easy to see what's going on.
For example, the iterator will filter out all the odd numbers from the array it takes, which is straightforward. Nim's if-else and case-switch statements look almost identical to Python's, with the exception of how it declares a variable. Moreover, the language also has built-in ternaries, which can include multi-line expressions.
Nim's mathematical operations include common functions such as square roots, rounding, and checking if a number is a power of two. It also has a neat feature called 'almost equals', which comes handy while comparing two values that might not exactly be equal but are approximately the same. Lastly, let's talk about Nim's string operators.
We can join or find index in the string, count the frequency of characters, remove white spaces, parse numerical value from strings, and even unindent them. Although there are some features of Nim that I find a bit confusing, such as the 'collect new sequence', I must admit that the overall readability of the code in this language is impressive.
Комментарии