March 2019
Intermediate to advanced
336 pages
9h 9m
English
A tuple is a finite sorted list of elements. It is a data structure that groups data. Tuples are typically immutable sequential collections. The element has related fields of different datatypes. The only way to modify a tuple is to change the fields. Operators such as + and * can be applied to tuples. A database record is referred to as a tuple. In the following example, power series of integers are calculated and the square and cube of the integer is returned as a tuple:
//main package has examples shown// in Hands-On Data Structures and algorithms with Go bookpackage main// importing fmt packageimport ( "fmt")//gets the power series of integer a and returns tuple of square of a// and cube of afunc powerSeries(a int) (int,int) { ...Read now
Unlock full access