Files
hello-algo/ru/codes/ruby/chapter_hashing/built_in_hash.rb
Yudong Jin 772183705e Add ru version (#1865)
* Add Russian docs site baseline

* Add Russian localized codebase

* Polish Russian code wording

* Update ru code translation.

* Update code translation and chapter covers.

* Fix pythontutor extraction.

* Add README and landing page.

* placeholder of profiles

* Use figures of English version

* Remove chapter paperbook
2026-03-28 04:24:07 +08:00

35 lines
907 B
Ruby
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
=begin
File: built_in_hash.rb
Created Time: 2024-04-13
Author: Xuan Khoa Tu Nguyen (ngxktuzkai2000@gmail.com)
=end
require_relative '../utils/list_node'
### Driver Code ###
if __FILE__ == $0
num = 3
hash_num = num.hash
puts "Хеш-значение целого числа #{num}: #{hash_num}"
bol = true
hash_bol = bol.hash
puts "Хеш-значение булева значения #{bol}: #{hash_bol}"
dec = 3.14159
hash_dec = dec.hash
puts "Хеш-значение десятичного числа #{dec}: #{hash_dec}"
str = "Hello Algo"
hash_str = str.hash
puts "Хеш-значение строки #{str}: #{hash_str}"
tup = [12836, 'Сяо Ха']
hash_tup = tup.hash
puts "Хеш-значение кортежа #{tup}: #{hash_tup}"
obj = ListNode.new(0)
hash_obj = obj.hash
puts "Хеш-значение объекта узла #{obj}: #{hash_obj}"
end