0 people like it.

Use right russian word for number of days

Select right russian word for number of days

 1: 
 2: 
 3: 
 4: 
 5: 
 6: 
 7: 
 8: 
 9: 
10: 
let showPrintMessage daysPassed = 
    let name = match abs(daysPassed) % 100 with
               | y when y >= 5 && y <= 20 -> "дней"
               | _ -> match abs(daysPassed) % 10 with
                      | 1 -> "день"
                      | 2 | 3 | 4 -> "дня"
                      | _ -> "дней"
    "Событие наступит через " + string daysPassed + " " + name + "!"

[1..30] |> List.map showPrintMessage
val showPrintMessage : daysPassed:int -> string

Full name: Script.showPrintMessage
val daysPassed : int
val name : string
val abs : value:'T -> 'T (requires member Abs)

Full name: Microsoft.FSharp.Core.Operators.abs
val y : int
Multiple items
val string : value:'T -> string

Full name: Microsoft.FSharp.Core.Operators.string

--------------------
type string = System.String

Full name: Microsoft.FSharp.Core.string
Multiple items
module List

from Microsoft.FSharp.Collections

--------------------
type List<'T> =
  | ( [] )
  | ( :: ) of Head: 'T * Tail: 'T list
  interface IEnumerable
  interface IEnumerable<'T>
  member Head : 'T
  member IsEmpty : bool
  member Item : index:int -> 'T with get
  member Length : int
  member Tail : 'T list
  static member Cons : head:'T * tail:'T list -> 'T list
  static member Empty : 'T list

Full name: Microsoft.FSharp.Collections.List<_>
val map : mapping:('T -> 'U) -> list:'T list -> 'U list

Full name: Microsoft.FSharp.Collections.List.map
Raw view Test code New version

More information

Link:http://fssnip.net/sh
Posted:9 years ago
Author:runiner
Tags: match , learning f# , russian