- 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

420 Views
In this tutorial, we will learn how to declare and add complex numbers in Golang. Complex numbers are something that has an imaginary and real part which will make them different from other types of numbers. Golang supports declaring a variable of complex number type. Complex Number = Real Number + Imaginary Number Different ways to declare and initialize complex numbers and add them later in Golang. Initializing using complex number init syntax Syntax var variableName complex64 var variableName complex128 variableName = (realValue) ... Read More

804 Views
This tutorial will show how we can add two binary strings in Golang. Also, we will cover and understand all the cases while adding two strings using examples. Example Suppose we want to add these two binary strings “111” and “1011” whose numeric values are 7 and 11 whose addition is 18 with binary representation “10010”. Now we will do the addition of these strings step by step below.variables with the respective values you want to multiply. As you can see the length of string “111” is less than “1011” so we have to make them equal for which ... Read More

649 Views
This tutorial will show how to multiply two float numbers within a function or by creating a separate function and calling it in the current function. Multiplying two float numbers within the function Algorithm STEP 1 − Defining the floating variables that we want to multiply and the floating variable in which we will add the result. STEP 2 − Initialize the variables with the respective values you want to multiply. STEP 3 − Multiply two numbers and store them in the third variable. STEP 4 − Print the result after multiplying two numbers. Example package main ... Read More

3K+ Views
In this tutorial, we will discuss adding two numbers in Golang. We will cover two approaches first adding two numbers within the function and second creating a different function. Adding two numbers within the function Algorithm STEP 1 − Defining the variables that we want to add. STEP 2 − Initializing the variables. STEP 3 − Add two numbers and store them in the third variable. STEP 4 − Print the result after adding two numbers. Example 1 In this example, we will add two integers within the function. package main // fmt package provides the function ... Read More

8K+ Views
In this tutorial, we will learn how to print a string in the Golang programming language. To print a string in Golang we have to use the package fmt which contains the input/output functions. The correct specifier tells the data type of variable we are printing. The specifiers we can use to print the strings are: %s − By using this we can print the uninterpreted strings or slice. %q − By using this we can print the string with double quotes. %x − By using this we can print the lower case character string with base 16. %X − By using this ... Read More

8K+ Views
In this tutorial, we will learn how to print an integer in the Golang Programming language. The fmt package is used to perform the input/output operations which are comparable to the input/output functions in C i.e scanf and printf. Also, format specifiers are referred from C but in Golang they are simple. We will discuss what specifiers we have for integers. Specifiers are something which will tell us the what data type we are printing. %b − for base 2 %o − for bae 8 %d − for base 10 Functions in fmt package:− fmt.Printf() − It ... Read More

226 Views
Let us understand the concepts of C++ and Go before learning the differences between them.GoIt is an open source programming language developed by Google employees, It is intended to be fast compiled, garbage collected, strongly typed, and with explicit support for concurrent programming.The original developers Rob Pike, Robert Griesemer and Ken Thompson started out in the year 2007. It was licensed under the BSD license. In the case of large systems it supports statically typing and scalability.FeaturesThe features of Go are as follows −Language DesignPowerful standard libraryPackage ManagementStatic TypingTesting SupportC-inspired syntaxCompiledSafe and open sourceAdvantagesThe advantages of Go are as follows ... Read More

3K+ Views
Title() is a built-in function of strings package in Golang that is used to convert a string into Title Case. It converts the first character of each word in a given string into uppercase and returns the modified string.Syntaxfunc Title(s string) stringWhere s is the given string.Example 1Let us consider the following example −package main import ( "fmt" "strings" ) func main() { // Intializing the Strings m := "title string function" n := "Golang string package fUNCTION" // Display the Strings fmt.Println("String 1:", m) fmt.Println("String 2:", n) // ... Read More

935 Views
strings.SplitAfter() is a built-in function in Golang that is used to break a string into a slice. SplitAfter is different from other Split functions. Here, we slice a given string into substrings after each instance of separators and it returns a slice of those substrings.Syntaxfunc SplitAfter(S String, sep string) []stringWhere s is the given string and sep is the separator string.Example 1Consider the following example −package main import ( "fmt" "strings" ) func main() { // Intializing the Strings x := "Golang Program of SplitAfter Function" y := "1.2.3.4.5.6.7.8" // Display the ... Read More

558 Views
strings.SplitN() is a built-in function in Golang that is used to split a given string into substrings by the given separator. It returns the slices of the substrings between those separators.Syntaxfunc SplitN(str, sep string, n int) []stringWhere, str is the given input string, sep is the separator string, andn defines the number of substrings that is to be returned.Example 1Consider the following example −package main import ( "fmt" "strings" ) func main() { // Intializing the Strings p := "1, 2, 3, 4, 5, 6, 7" q := "Welcome to Golang Programming Language" r := ... Read More