Ad
  • Custom User Avatar

    https://docs.ruby-lang.org/en/master/doc/syntax/literals_rdoc.html

    "There is also a character literal notation to represent single character strings, which syntax is a question mark (?) followed by a single character or escape sequence that corresponds to a single codepoint in the script encoding:"

    It is in the Ruby documentation. No, it's not Symbols (:Ruby) but it's quite a mess since originally this was intended as a Number literal but doing ?a to get 97 was confusing and it wasn't intuitive so now it's a String and people can just do ?a.ord for 97.

  • Default User Avatar

    Sorry if this is real nooby question, but why does ?* == * as a string
    I cant find anything about ?* in the Ruby documentation
    Edit: also how do I put code into the little boxes like Unihedron has?

  • Custom User Avatar

    Checks the binary 1st digit. 1 is odd.

  • Custom User Avatar

    Very nice. Just: what does ".count{|d| d[0] == 0}" ?

  • Default User Avatar

    I cant understood...
    Awesome solution!

  • Custom User Avatar

    I got error message even the test is passed.
    I delete all the code, just kept the return 0 if array.empty? and i got error below the right return.

    Test Passed: Value == 0

    main.rb:5:in getLengthOfMissingArray' main.rb:21:in block (2 levels) in
    '
    /runner/frameworks/ruby/cw-2.rb:180:in wrap_error' /runner/frameworks/ruby/cw-2.rb:72:in it'
    /runner/frameworks/ruby/cw-2.rb:206:in it' main.rb:10:in block in
    '
    /runner/frameworks/ruby/cw-2.rb:55:in block in describe' /runner/frameworks/ruby/cw-2.rb:46:in measure'
    /runner/frameworks/ruby/cw-2.rb:51:in describe' /runner/frameworks/ruby/cw-2.rb:202:in describe'
    main.rb:9:in `
    '

  • Custom User Avatar

    Hum! Very interesting, thank you!

  • Custom User Avatar

    Strings are mutable in Ruby, when the validation function is executed, it uses the value you previously mutated, giving the wrong result.

  • Custom User Avatar

    The + instead of the <<... obviously!
    What i don't understand and what make me stop testing other obvious solutions is the fact that the "expected" result is wrong. How can it be?

  • Custom User Avatar
    string_1 = "Hello"
    string_2 = " World"
    string_3 = string_1 << string_2
    puts string_3 #Hello World
    puts string_1 #Hello World
    

    You're mutating first_name in your get_full_name method. Use another way to do string concatenation that doesn't mutate your strings.

  • Custom User Avatar

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

  • Custom User Avatar

    No, it's not like you claim. You're probably mutating the input or your initializer is wrong. Why don't you show your code? I can't help you if you don't do that.

  • Custom User Avatar

    All the inputs in the submit final tests are expecting to be doubled.
    Without any code, you can tell if an input "Name" is expecting result "Name Name". I think we are not expecting that.

    One more example :
    Expected: "Clint Southhill Southhill", instead got: "Clint Southhill"
    Input: "Clint", "Southhill"

  • Custom User Avatar

    AFAIK Ruby tests work. It's probable your code is the culprit, can't tell without seeing it, remember to use Spoiler content flag if you post it.

  • Custom User Avatar

    Expected: "Southriver Southriver", instead got: "Southriver"
    Inputs : "Southriver"

  • Loading more items...