Ad
  • Custom User Avatar

    Question resolved.

  • Custom User Avatar

    Not a kata suggestion. Resolved.

  • Custom User Avatar

    The error you see happens before the check. The error is raised in line 2, and your check is too late, in line 3.

    It's a bug in your solution, not a kata issue.

  • Custom User Avatar

    That's a problem with your code, not with the kata.

  • Default User Avatar

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

  • Default User Avatar

    I don't get it ? ...isn't supposed to be simple fundamentals ?
    I write in JS so typeof is default XD

  • 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

  • Default User Avatar

    Can someone with edit abilities please add the following 3 tests to the Error Test Cases section. Currently this specific test is only being done for +, not the other operators, and it's allowed some solutions to get through (and be highly upvoted) that don't actually meet all the requirments in the description.

    test.assert_equals(calculator(":", ",", '-'),"unknown value")
    test.assert_equals(calculator(":", ",", '*'),"unknown value")
    test.assert_equals(calculator(":", ",", '/'),"unknown value")

  • Default User Avatar

    BRO you are my savior xd, thanks

  • Default User Avatar

    what's wrong?
    error of all tests:
    Failed asserting that null matches expected 3.
    Expected: 3
    Actual : null
    in sandbox all works
    function calculator($a, $b, $sign) {
    if ( is_int($a) & is_int($b) ) {
    switch ($sign) {
    case "+":
    $c = $a+$b;
    break;
    case "-":
    $c = $a-$b;
    break;
    case "":
    $c = $a
    $b;
    break;
    case "/":
    if ($b == 0) {
    $c = "unknown value";
    } else {
    $c = $a/$b;
    }
    break;
    default:
    $c = "unknown value";
    }
    } else {
    $c = "unknown value";
    }
    echo $c;
    }

  • Default User Avatar

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

  • Default User Avatar

    I think it is not a spoiler and it must be reported. I've lost 2 hours to find this information! "type(x) == int" checks that x is a number! It will be very important for many people!

  • Default User Avatar
  • Default User Avatar

    For some reason I cannot resolve this issue, can someone else please do it?

  • Loading more items...