moduleRandom=openSystemletprivater=newRandom()letcoinToss=fun_->r.Next(0,2)letprintNumbersn=matchn%2=0with|true->printfn"Even nr. %i"n|false->printfn"Odd nr. %i"nletprintNumbers'n=//Missed"else"statementisfoundatruntimeifn%2=0thenprintfn"Even nr. %i"nList.init10(Random.coinToss)|>List.iterprintNumbersList.init10(Random.coinToss)|>List.iterprintNumbers'
Code output:
Code Snippet:
1
2
3
4
5
6
7
letprintNumbers''n=//Missed"false"matchisfoundatcompile-timematchn%2=0with|true->printfn"Even nr. %i"nList.init10(Random.coinToss)|>List.iterprintNumbers''