Ad
  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    Hey guys, just starting to learn Ruby and coding, struggling with codewars currently. With this particular kata, I am certain I understand the exercise. What I would like my method to do is

    1. Stop calculating the current size of the population when it is at least equal to p - so something like a 'while' or 'unless' or 'if' loop I think e.g. while p0 <= p "execute code"
    2. The calculation seems easy enough - should be something like p0.to_ + (p0.to_i * (percent.to_f / 100)) + aug.to_i
    3. So while p0 <= p; p0 variable will be reassigned using the sum above
    4. Then obv I need to count how many times the sum has been run/calculated, and that is the total number of years (n).

    Is my understadning of the exercise where it should be? If so, what should I be considering to create the correct code?