Skip to content

Commit

Permalink
Example for Ordinal
Browse files Browse the repository at this point in the history
  • Loading branch information
mjradwin committed Dec 13, 2022
1 parent 9e1e120 commit 68b5e86
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions number/ordinal_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package number_test

import (
"fmt"

"github.com/hebcal/hebcal-go/number"
)

func ExampleOrdinal() {
vals := []int{1, 2, 3, 4, 11, 12, 13, 14, 41, 42, 43, 44}
for _, val := range vals {
fmt.Printf("%d -> %s\n", val, number.Ordinal(val))
}
// Output:
// 1 -> 1st
// 2 -> 2nd
// 3 -> 3rd
// 4 -> 4th
// 11 -> 11th
// 12 -> 12th
// 13 -> 13th
// 14 -> 14th
// 41 -> 41st
// 42 -> 42nd
// 43 -> 43rd
// 44 -> 44th
}

0 comments on commit 68b5e86

Please sign in to comment.