Skip to content

Latest commit

 

History

History
25 lines (21 loc) · 635 Bytes

File metadata and controls

25 lines (21 loc) · 635 Bytes

Tuples

A finite sorted list of elements.

go code example

package main
import("fmt")
//return tuple of square and cube of integer "a"
func powerSeries(a int) (int,int) {
return a*a, a*a*a }

func main(){
// execute test return of a tuple
square, cube := powerSeries(3)
fmt.Println("Square ", square, "Cube", cube)
      }

data structure that groups data

  • 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
  • database record is referred to as a tuple