Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Question resolved.
Not a kata suggestion. Resolved.
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.
That's a problem with your code, not with the kata.
This comment is hidden because it contains spoiler information about the solution
I don't get it ? ...isn't supposed to be simple fundamentals ?
I write in JS so typeof is default XD
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
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")
BRO you are my savior xd, thanks
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;
}
This comment is hidden because it contains spoiler information about the solution
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!
For some reason I cannot resolve this issue, can someone else please do it?
Loading more items...