https://snap.berkeley.edu/project?username=cuterobot22&projectname=Is%201%2B1-1%3F%20NOT%20WORKING
I tried to do this project as a use of reporters, but it says the reporter did not report. I thought that was it's job.
Get it wrong to find the error.
The else clause will never run, as the expression <false> will never be true.
Your problem is that you set the else if condition to false, making it not run. It needs to be
if <(answer) = [1]> {
report <<true>>
} else if <t> {
report <<false>>
} @delInput @addInput This is basically just doing
if <> {
...
} else {
if <t> {
...
}
} Then again, if you're just doing a simple check like this, it's even easier to just do
report <(answer) = [1]>
change the custom block definition to report <(answer) = [1]
That is because you are using the <is answer 1> boolean that you made, which still has the definition:
if <(answer)=[1]>{
report <<true>>
}else if <f>{
report <<false>>
}@delInput@addInput "Else if false" will never trigger, because false is never true.
flip the switch after else if
, or just report <(answer) = [1]>
Well you didn't save the project.
cuterobot22:
That's what I did.
You need to flip the switch in your custom block definition as well as in your code. This will work:
So will this:
You could also have done:
or
(Is answer 1?) :: define+
report (if <(answer) = [1] $delInput $verticalEllipsis $addInput> then [Correct!] else [Nope.])
That makes sense, but it still does not work! I think I am doing something wrong.
You haven't saved, so we can't see what's wrong. You still have the else if false.
As I have repeatedly said, just change the block definition to
report <(answer) =[1] Also you have not saved the project…
Is not the same as:
The second one is the one you should be using. You accidentally flipped the wrong switch ;).