i has the following
class test hash={} def printHash puts hash[1] puts hash[2] puts hash[3] end end test.new.printHash
this prints:
1 0 1
Why is this happening? how can i check if i put something in this hash place? or am i missing something
, , , - , hash , Fixnum hashcode . Fixnum, . , sigil @. , , , , , initialize:
hash
@
initialize
class Test def initialize @hash = {} end def printHash puts @hash[1] puts @hash[2] puts @hash[3] end end
nil . , , has_key?.
nil
has_key?
"" , , printHash, , nil ( ), Pesto , "hash" - - .
"@" initialize ( "new" ), .
Source: https://habr.com/ru/post/1708088/More articles:stack collection missing shift and offset in C # 2.0 - collectionsHow to copy an open file using VB6? - vb6jQuery hover and close method - javascriptHow can I read the SNMP MIB file in C #? - c #Installed visual SVN server, except that I receive this message when SVN Check Out - svnHow to publish a Dynamics CRM4 plugin with multiple assemblies? - pluginsNULL controller parameter when using jQuery POST and ASP.NET MVC - jqueryWhy does maven-assembly-plugin put the same dependency in my zip several times? - javaTime Counter (TSC) when switching between Kernel & User mode - linuxI get a new javascript for every GWT compiler without changing the java source - gwtAll Articles