is there have pipe operation?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By freakcoco

something like Ruby pipe

foo("fist input") |> bar |> print
:bust_in_silhouette: Reply From: Eric Ellingson

I think you are stuck with:

var output = foo("first input")
output = bar(output)
print(output)

Wouldn’t the closest equivalent to that sample code be to avoid the variable with simple nested calls, i.e: print( bar( foo("first input") ) )

Peter Boughton | 2019-08-19 18:52

Probably, but readability is generally preferred to brevity (At least in my opinion)

Eric Ellingson | 2019-08-19 18:59