J
Johnathan Smith
Hi there
im writing a class which produces refrences in a hash
however im trying to deal with multiple authors
so i want to write an if statement where
if the key already exists
push value onto it
im unsure of how to do this so any help would be much appreciated
many thanks
code:
class Reference
@data
add_field(field, value)
if key already exits
push value onto it
else
@data[field]=value
end
get(field)
@data[field]
end
end
im writing a class which produces refrences in a hash
however im trying to deal with multiple authors
so i want to write an if statement where
if the key already exists
push value onto it
im unsure of how to do this so any help would be much appreciated
many thanks
code:
class Reference
@data
add_field(field, value)
if key already exits
push value onto it
else
@data[field]=value
end
get(field)
@data[field]
end
end