Search
ctrl/
Ask AI
Light
Dark
System

Scalars

Subtopics

Tuples, like arrays, are ordered collections of scalar values, but the elements don't have to be the same type.

Input
Run
Output Objects
Press the 'Run' button to evaluate the input

In fact, tuple elements can be values of any type including arrays and other tuples:

Input
Run
Output Objects
Press the 'Run' button to evaluate the input

Tuple elements can be accessed by specifying an index after a .:

Input
Run
Output Objects
Press the 'Run' button to evaluate the input

This works for nested tuples too:

Input
Run
Output Objects
Press the 'Run' button to evaluate the input

Tuples can also give names to their elements. In that case the tuple elements can be accessed by either name or index:

Input
Run
Output Objects
Press the 'Run' button to evaluate the input
Input
Run
Output Objects
Press the 'Run' button to evaluate the input
Input
Run
Output Objects
Press the 'Run' button to evaluate the input

Naming elements can make nested tuples quite readable:

Input
Run
Output Objects
Press the 'Run' button to evaluate the input

You can also use casts to change the type of the elements inside tuples by using a "nested" cast notation:

Input
Run
Output Objects
Press the 'Run' button to evaluate the input