Implicit type conversion: Difference between revisions
Added Idris task
(Added Sidef) |
(Added Idris task) |
||
Line 351:
<3:1> !. * 2 false #boolean false is equal to 0
0</lang>
=={{header|Idris}}==
Idris provides the "[http://docs.idris-lang.org/en/latest/tutorial/miscellany.html#implicit-conversions implicit]" keyword which enables the implicit conversion from one type to another.
<lang idris>implicit
boolToInt : Bool -> Int
boolToInt True = 1
boolToInt False = 0
one : Int
one = 1
two : Int
two = one + True</lang>
=={{header|J}}==
|