Binary digits: Difference between revisions

m
m (→‎{{header|F Sharp|F#}}: removed excessive whitelines)
Line 948:
 
=={{header|F Sharp|F#}}==
Translation of C#, using imperative coding style:
<lang FSharp>open System
for i in [5; 50; 9000] do printfn "%s" <| Convert.ToString (i, 2)</lang>
 
Alternative way, by creating a function <code>printBin</code> which prints in binary:
Alternative way:
<lang FSharp>open System
 
// define the function
let printBin (i: int) =
Convert.ToString (i, 2)
|> printfn "%s"
 
// use the function
[5; 50; 9000]
|> List.iter printBin</lang>
Anonymous user