Tuple of TypeScript and Python

오픈소스·2022년 3월 2일
0

TypeScript

튜플: 길이가 고정

  • single type array
    - let list: number[] = [1, 2, 3];

  • readonly single type array
    - const values: readonly string[] = ["a", "b", "c"];

  • multiple type array
    - let x: [string, number] = ["hello", 10];

  • readonly multiple type array
    - const point: readonly [number, string] = [0, "a"];

Python

  • single type array
    - basketOfFruits = ['orange', 'apple', 'banana', 'strawberry']

  • readonly single type array
    - front_end = ("html", "css", "javascript")

  • multiple type array
    - strangeList = [4, 10.2, "cherry", ["an other list", 1]]

  • readonly multiple type array
    - information = ("Jimmy", 50, True, "Kate", 50)
    - nestedTuple = ('hello', [1 ,2, 3], (4, 5, 6))

0개의 댓글