Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the '*' used for in this example?

Tags:

f#

I am trying to figure out how to design a type for trees in F# and was looking at this thread for some help Tree Representation in F#.

In it, they define:

type Tree =
  | Branch of string * Tree list
  | Leaf of string

I am not sure what the * operator between string and Tree is supposed to do. I have been seeing it all over the place, but don't know what to search to find the answer.

Thanks!

like image 318
Tallwhitebro Avatar asked Nov 22 '25 03:11

Tallwhitebro


1 Answers

This is the Tuple type name, from Microsoft Documentation

Names of Tuple Types

When you write out the name of a type that is a tuple, you use the * symbol to separate elements. For a tuple that consists of an int, a float, and a string, such as (10, 10.0, "ten"), the type would be written as follows.

int * float * string
like image 127
Mahmoud Darwish Avatar answered Nov 24 '25 23:11

Mahmoud Darwish



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!