This tutorial explains different datatypes provided by the NIM Programming language.

Nim datatype

  • Integer
  • Floats
  • Char
  • String
  • Boolean

Let’s discuss different datatypes

  • Integer

An integer is a numerical datatype used to declare numerical values.

Example values 2,-56,101

It contains uint8, uint16, uint32 and uint64 and int8, int16, int32, and int64 to represent integer values.

It contains int and uint to represents

let number=123
  • Floats

Floats are floating numbers and examples are 1.1,-4.2,

let p=123.12
  • Character data type

char is used to represent a single character. Characters can be ASCII or alphabet characters.

Characters are defined using a single tick operator

let character = `a`
  • Strings data type

The string data type is used to represent a group of characters enclosed in double-quotes.

let name = "abcdef"
  • Bool data type

Boolean contains true and false values. It is used to represent the truthness of a NIM expression.

It is used in Control flow statements and relational operators.

let exists =  true
let enable = false

String types

String is a sequence of characters. It is enclosed in single, double , or triple quotes.

let str =  " welcome"
let name = "eric"

What type of byte is Nim?

Nim contains byte type to store binary blob objects.

use seq[byte]To deal with binary data.

It is similar to or equal to uint8.