I have two question regarding ruby programming if someone can help me
with that,I am looking for the syntax as i am confused with these
questions.
Define a method attr_accessor_with_history that provides the same
functionality as attr_accessor but also tracks every value the attribute
has ever had.
the Enumerable module includes an iterator each_with_index that
yields each enumerable element along with an index starting from
zero(recall that Enumerable is mixed into Ruby’s built in collection
classes by default)
yields each enumerable element along with an index starting from
zero(recall that Enumerable is mixed into Ruby’s built in collection
classes by default)
Actually, no - you have an imperative statement and an ostensibly
factual statement. Would you like to ask questions about those? If
so, what are they exactly?
yields each enumerable element along with an index starting from
zero(recall that Enumerable is mixed into Ruby’s built in collection
classes by default)
Actually, no - you have an imperative statement and an ostensibly
factual statement. Would you like to ask questions about those? If
so, what are they exactly?
People in this list are usually reluctant to just hand out solutions
for homework, specially if the person asking the question doesn’t show
some effort in trying to solve the problem by themselves. If you had
done some effort and be blocked by something you didn’t understand,
you would probably ask a very different question than the one you’ve
asked and you would get better answers.
Just to point you in the right direction if you are really lost: look
around the internet for a ruby implementation of attr_accessor (there
are a lot of examples of how you would go about implementing it), and
then modify that implementation so that you store the previous value
in an array.
If you have any problem just show us what you’ve done, and what’s
blocking you and we will try to help.