There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply () below.
If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.
Join the Discussion. Help a fellow learner on their journey.
Ask or answer a question about this exercise by clicking reply () below!
Agree with a comment or answer? Like () to up-vote the contribution!
Hello. I thought I understood this pretty well until I had to access the answer. Can someone please explain it to me? I looked up Proc and .new but I still don’t think I completely understand it.
Hello,
Could somebody explain the difference between .collect and .each?
What I understand is that both pick each element of an array and perform a given task.
collect returns an array. each returns only the input array, and looks to ignore the action in the block.
double_fibs = fibs.each {|x| x * 2}
puts double_fibs
Output
[1, 1, 2, 3, 5, 8, 13, 21, 34, 55]
The output array would have to be created initially, then the each method could iterate over the input array, operate on each element then push it to the output array.
I think this exercise is totally messed up. The examples doesnt help at all. I tried to copy in the above examples but it doesn’t work. Im not sure if its only me or something else but this is not the first time I don’t get a whole lesson because of the poor explanation. The “solution” gives me something totally new that I have never seen before… I hope others will succeed
I thought the explanation was simple enough but when I kept getting errors I chose to view the solution, once I did I was completely confused because there were some things I never saw before. Proc and &double notably. I was left very confused.
I don’t think your the only one. I think the biggest problem with coding is its very complicated and the teaching of it is often sub par or flat out awful.
Hard to have a valuable opinion of the quality of teaching when the subject is completely unknown. Learning is the responsibility of the learner. Criticizing a teacher gets them nowhere. Only when committed to due diligence does a learner get anything of real value from a subject. It does not come from the teacher, they are only the presenters. Value comes from what we put into a subject, be that interest, effort, excitement, experimentation, exploration, etc.
you explain/convey information a hundred times more effective than the solution on this lesson, and past lessons. teaching CS is a skill, like teaching violin as I did, and you display information and answer questions in a way that while challenging, remains accessible to one who is determined, curious and willing to explore the subject. thank you.
I think the issue many of us are running into, is that the accepted solution for the problem includes pieces of code that have yet been revealed to use, while the rest of the exercises use things we’re currently learning, or have been discussed. the solution is the first time we’ve seen “.proc”.
I go the correct output by using code topics we’ve already learned, but it was not accepted as an answer. We can look at the solution and then go look things up, but then that defeats the purpose of having the challenge, in my opinion.