- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 1082 Articles for Go Programming
![Akhil Sharma](https://www.tutorialspoint.com/assets/profiles/525598/profile/60_3453735-1664185297.jpg)
2K+ Views
In this tutorial, we will learn how to convert string variables to double in Go programming language. String is a data type which is used to store characters or alphabets. Strings have a size of 1 byte or 8 bits. Whereas double is a data type which is used to store double precision floating point numbers. The size of double is 64 bits or 8 bytes. Program to Convert String type Variable to Double Using ParseFloat() Method Syntax func ParseFloat (s string, bitsize int) (float 64, error) ParseFloat() function is used to convert strings to float type values. This ... Read More
![Akhil Sharma](https://www.tutorialspoint.com/assets/profiles/525598/profile/60_3453735-1664185297.jpg)
11K+ Views
In this tutorial, we will learn how to convert string type variables into int in Go programming language. For this task various types of string conversions are needed, to perform the conversions “strconv” package is imported in the go language program, Strings can be transformed into integer values using the ParseInt function. It decodes a string in the specified base (0, 2 to 36) and bit size (0, 64), and then it returns the equivalent result. Convert String Type Variable Into Int Syntax func ParseInt(s string, radix/base int, bitSize int) (i int64, err error) ParseInt() function is used to ... Read More
![Akhil Sharma](https://www.tutorialspoint.com/assets/profiles/525598/profile/60_3453735-1664185297.jpg)
4K+ Views
In this tutorial, we will learn how to f convert string type variables into Boolean in Go programming language. Boolean Vs String Boolean is a data type having 1-byte size. It can store any one of the three values mainly True, False or none. It acts like a flag to show whether a condition is correct or not. String data type is used to store a sequence of characters. it can be in the form of literals or alphabets. The size of string variable is 1 byte or 8 bits. For this task various types of string conversions are needed, ... Read More
![Akhil Sharma](https://www.tutorialspoint.com/assets/profiles/525598/profile/60_3453735-1664185297.jpg)
515 Views
In this article you will know how to convert the decimal number to octal in Go language. For this we are going to use the FormatInt() function of strconv package. When we say convert the decimal number to octal, it means to convert the number with the base value 10 to the base value 8. The base value means the number of digits required to represent the numeric value. Example 1: Go Language Program to convert Decimal Number to Octal using Library Function Syntax func FormatInt(input int64, base int) string for [condition | ( init; condition; increment) | Range] ... Read More
![Akhil Sharma](https://www.tutorialspoint.com/assets/profiles/525598/profile/60_3453735-1664185297.jpg)
2K+ Views
In this article you will learn the go language code to convert decimal number to Hexadecimal. Decimal Number Vs Hexadecimal Numbers Decimal numbers are the numbers which have base 10, which means each digit of a number can have an integer value ranging from 0 to 9 (10 possibilities) depending on its position. For example, 23 is a decimal number. Any number contains 16 digits in it, it is based on base 16, which means hexadecimal numbers contains decimal number from 0 to 9 and extra 6 Alphabets. A−F. In go language all the hexadecimal numbers start with 0x or ... Read More
![Akhil Sharma](https://www.tutorialspoint.com/assets/profiles/525598/profile/60_3453735-1664185297.jpg)
4K+ Views
In this tutorial, we will learn how to convert Boolean to a string in Go programming language. Boolean Vs String Boolean is a data type having 1 byte size. It can store any one of the three values mainly True, False or none. It act like a flag to show whether a condition is correct or not. String data type is used to store a sequence of characters. it can be in the form of literals or alphabets. The size of string variable is 1 byte or 8 bits. Example 1: Convert Boolean type to String USING strconv.FormatBool() Method Syntax ... Read More
![Akhil Sharma](https://www.tutorialspoint.com/assets/profiles/525598/profile/60_3453735-1664185297.jpg)
484 Views
In this article we will discuss about how to check if a given number is odd using library function Go language. ODD NUMBERS − In mathematics any number is called odd if it gives “1” as remainder when divided by “2”. For example 1, 3, 5, 7 …. Even Numbers − unlike odd numbers even numbers get completely divided by “2” and do not produce any remainder. For example − 2, 4, 6, 8 … Syntax func Mod(number1, number2 float64) float64 The mod() function is defined in the math package. This function returns the remainder by dividing the two numbers ... Read More
![Akhil Sharma](https://www.tutorialspoint.com/assets/profiles/525598/profile/60_3453735-1664185297.jpg)
22K+ Views
In this tutorial we will learn how to check if a given value is present in a Go−lang array or not. We will use 2 methods for this. Method 1: Using a for loop directly in the main function We will use a for loop to iterate over the elements of an array in Golang and check for the equality of values using the equality operator. If the values match then we can stop the iteration and say that the given value is present in the array. Method 2: Using the function Golang does not have any pre-defined library function ... Read More
![Akhil Sharma](https://www.tutorialspoint.com/assets/profiles/525598/profile/60_3453735-1664185297.jpg)
639 Views
In this tutorial we will write a go language code to check whether an alphabet is vowel or consonant. Difference between Vowel and Consonant A character is called vowel if it is in any one of the following list of characters {a, e, I, o, u}. All the remaining characters are called consonants. In English language there are 5 vowels and 21 consonants. Here we are going to use following 2 methods − Method 1: Using if/else statement In this method we will use the conditional statements to check if a character is a vowel or consonant. Method 2: Using ... Read More
![Akhil Sharma](https://www.tutorialspoint.com/assets/profiles/525598/profile/60_3453735-1664185297.jpg)
348 Views
In this article we will discuss about how to get total bits required for the given number using library function in Go language. To get the total number of bits of any number we need to represent that number in binary which is a combination of zeroes and ones and then count the number of zeroes and ones. For example: 16 can be converted in binary as 10000 and therefore number of bits in number 16 are 5. 65 can be converted in binary as 1000001 and therefore number of bits in number 65 are 7. Syntax Functions − func ... Read More