Skip to content

Latest commit

 

History

History
48 lines (34 loc) · 1.06 KB

operators_triangle_pipe.mdx

File metadata and controls

48 lines (34 loc) · 1.06 KB
idkeywordsnamesummarycategorystatus
triangle-pipe
pipe"
triangle
operator
function
argument
|>
This is the `triangle pipe` operator.
operators
deprecated

The |> operator passes a value to a function as its last argument.

Note that this operator has been deprecated. See Triangle Pipe for more details.

Example

<CodeTab labels={["ReScript", "JS Output"]}>

letdieRoll=size=> { Math.Int.random(1, size) } letdieRollMessage= (name, value) => { "Hi "++name++", you rolled a "++Int.toString(value) } letmessage=dieRoll(6) |>dieRollMessage("Jeremy")
functiondieRoll(size){returnCore__Math.Int.random(1,size);}functiondieRollMessage(name,value){return"Hi "+name+", you rolled a "+value.toString();}varmessage=dieRollMessage("Jeremy",dieRoll(6));

Which produces a message such as Hello Jeremy, you rolled a 3.

References

close