You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A pattern clause is a tuple(pattern, statements, ...extra_args)
Because tuple is not a build-in data type in JavaScript, we use array instead. For example, we may try to match a value against 3 patterns in the following order.
Both an array and a tuple groups an ordered sequence of data. In a typed language, array usually refers to a group of data having the same type, whereas tuple doesn't have such a restriction. In JavaScript an array can have data of mixed types; therefore there is no need for the tuple type.
For those who are always thinking about types and not comfortable to see an array of mixed typed data, the following constructs might be more pleasant to your eyes.
A pattern clause is a tuple
(pattern, statements, ...extra_args)
Because tuple is not a build-in data type in JavaScript, we use array instead. For example, we may try to match a value against 3 patterns in the following order.
Both an array and a tuple groups an ordered sequence of data. In a typed language, array usually refers to a group of data having the same type, whereas tuple doesn't have such a restriction. In JavaScript an array can have data of mixed types; therefore there is no need for the tuple type.
For those who are always thinking about types and not comfortable to see an array of mixed typed data, the following constructs might be more pleasant to your eyes.
The text was updated successfully, but these errors were encountered: