Golang Tutorial
Learn Golang tutorials with examples

May 10, 2023 · 1 min read
This short tutorials explains about how to get variable type. How to get Variable datatype in Julia typeof()function accepts variable, and returns the variable datatype Print the result to console using println statement. Here is an example number = 11 println(typeof(number)) number1 = 11.12 println(typeof(number1)) name = "str" println(typeof(name)) flag = false println(typeof(flag)) println(typeof(Set([1,2,3]))) Output: Int64 Float64 String Bool Set{Int64} How to Check given variable is an Integer type isa operator checks an given variable or expresion is an given data type....
May 9, 2023 · 1 min read
This tutorials explains about convert String to int and int to string in Nim language with examples. How to convert String to Int in Nim parseInt in strutils module convert given string to integer. It throws an ValueError if string is invalid number. Here is an example import strutils const value = parseInt("12") echo typeof(value) # int echo value # 12 How to convert Int to String in Nim Multiple ways we can convert int to string in nim....
May 8, 2023 · 1 min read
This tutorial explains about following things Find the size of an array in Nim Find length of an sequence in Nim Array and sequence are data structures used to store(container) collection of elements. Size of these containers contains number of elements in it. How do you find the length of an array in Nim? Please following below steps to find the length of an array. Array contains len procedure to return an size of an array....
May 5, 2023 · 2 min read
This tutorial explains Environment variables in NIM. How to read environment variable The os module contains the getEnv procedure that returns the environment variable value for a given variable. syntax: if the environment variable is not found, return the default value proc getEnv(key: string; default = ""): string {.....} import os echo getEnv("HOME") HOME is equivalent to $HOME in Linux(Unix) and %HOME% in Windows Another example import os echo getEnv("NIM_HOME","default") It returns either value or default if not found....
May 5, 2023 · 1 min read
This tutorials explains about how to concatenate Strings in Nim language. Nim String Concatenate example There are multiple ways, we do string append in NIM language. using & operator & operator appends one string into end of another string. var str = "one " var str1 = "two " var result= str & str1 echo result using strutils join function strutils module has join procedure that joins the openarray of elements to append Syntax:...
Recent posts
Julia examples - Variable Type Nim example - Convert String to/from the Int How to get length of an array and sequence in Nim? Nim environment variables - read, set, delete, exists, and iterate examples? How to convert from single character to/from string in Nim?