sumim #5339(2008/01/16 02:18 GMT) [ Smalltalk ] Rating0/0=0.00
考えたら、べつに無限にせずともこれで十分ですね(^_^;)。
1 2 3 4 5 6 7 8 9 10 11
| 閏年か? | 閏年か? := [:int | ((0 to: int by: 4) includes: int) and: [((0 to: int by: 100) includes: int) not or: [(0 to: int by: 400) includes: int]]]. 閏年か? value: 1900. "=> false " 閏年か? value: 2000. "=> true " 閏年か? value: 2008. "=> true " 閏年か? value: 2100. "=> false "
Rating0/0=0.00-0+
1 reply [ reply ]
sumim
#5339()
[
Smalltalk
]
Rating0/0=0.00
考えたら、べつに無限にせずともこれで十分ですね(^_^;)。
| 閏年か? | 閏年か? := [:int | ((0 to: int by: 4) includes: int) and: [((0 to: int by: 100) includes: int) not or: [(0 to: int by: 400) includes: int]]]. 閏年か? value: 1900. "=> false " 閏年か? value: 2000. "=> true " 閏年か? value: 2008. "=> true " 閏年か? value: 2100. "=> false "Rating0/0=0.00-0+