7
votes
Vote UpVote

The Either type for Delphi

Delphi sorcery – In a previous post I talked about the Maybe type that similar to the Nullable type allows you to handle values or the state of having no value in a functional approach.Today I show you another type that is common in functional programming - the Either type. It allows you to return 2 different types from one function. This could be for example the content of a web request or an error message. In our example we are using similar code as in the previous post and return the result of a division or an error message.Here is how the function would look like:function Divide(x, y: Integer): ...
Favorite? Off-Topic? noreply@blogger.com @ 2015-01-25 13:52

Statistics

Visits: 1294
Votes: 7
Favorites: 0
Off-Topic: 0

Visits by Source

User Actions

Users who voted for this posting

Ales Kacijan
Alister Christie
Linas
NickHodges
Primoz Gabrijelcic
VICovSki
vintagedave
Subscribe:
Contact us to advertise on DelphiFeeds.com

Community Links

Torry Firebird News

Sponsor

 
Please login or register to use this functionality.
(click on this box to dismiss)