Ad
  • Custom User Avatar

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

  • Custom User Avatar

    Hi. What exactly is the problem with the while loop?

  • Custom User Avatar

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

  • Custom User Avatar

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

  • Custom User Avatar

    I think there is some criteria for minimum honor to unlock solution section without solving it, so you have to solve more problems and unlock that button.

  • Custom User Avatar

    Already answered in your other post, the problem was you used elsif there:

    elsif
    
    ns = 0 # this is line 7
    

    There it was your = in a conditional
    The current code works (see how you use proper markdown so your code doesn't lose indentation and such).

  • Custom User Avatar

    I added my whole solution code.

  • Custom User Avatar
    1. This is not a bug, but issue with your code
    2. Yes, you can leave your solution under a spoiler tag if you need some help.
    3. You are not providing your whole code. You excluded beginning and end of the function (though when you asked this question on forum you posted the whole code, not part of it), because of this we can see a correct loop, but we can't see your elsif right before the loop which has no condition to be tested on.
  • Custom User Avatar

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

  • Custom User Avatar

    Also here it can't be marked as containing spoilers.

    elsif
    
    ns = 0 # this is line 7
    

    There it is your = in a conditional

  • Custom User Avatar

    Is this a bug?

    This is asking a wrong question in a wrong place...

  • Custom User Avatar

    I've met a problem in Kata 'Take a Ten Minute Walk' - http://www.codewars.com/kata/take-a-ten-minute-walk/train/ruby

    My code:

    def isValidWalk(walk)
    if walk.length!=10
    return false
    elsif
    ns = 0
    ew = 0
    for i in 0..walk.length-1 do
    if walk[i]=='n'
    ns=ns+1
    elsif walk[i]=='s'
    ns=ns-1
    elsif walk[i]=='e'
    ew=ew+1
    elsif walk[i]=='w'
    ew=ew-1
    end
    i+=1
    end

    if ns==0 && ew==0
      return true
    else
      return false
    end
    

    end
    end

    All tests passed correctly, but the system tells me about an Error:

    STDERR:

    main.rb:7: warning: found = in conditional, should be ==

    But the string #7 is: for i in 0..walk.length-1 do
    It does not contain symbol '='...

    Is this a bug?