'뭐병시나'에 해당되는 글 1건

  1. 2008.11.27 tricky(?)....... by sloth_chord

tricky(?).......

bite_a_bit/bitter 2008. 11. 27. 10:30

1. Ruby's

a. integer 0 is true
puts (0) ? 'true' : 'false' # true


b. string is mutable


2. divide

; Scheme

(remainder 175 10) ; 5

(/ 175 10) ; 17 1 / 2

(remainder 175.0 10) ; 5.0

(/ 175.0 10) ; 17.5

(remainder 175 10.0) ; 5.0

(/ 175 10.0) ; 17.5

(truncate (/ 175 10)) ;17

(truncate (remainder 175 10.0)) ; 5.0

(truncate (/ 175 10.0)) ; 17.0


# Ruby

puts 175 % 10     # 5

puts 175 / 10     # 17

puts 175.0 % 10   #5.0

puts 175.0 / 10 # 17.5

puts 175 % 10.0 # 5.0

puts 175 / 10.0 # 17.5


 

Posted by sloth_chord

댓글을 달아 주세요