-1

I have a statement in my script like this:

if(some condition)
{
 false;
 //rest of code
}

I am not getting the meaning of the false; statement as standalone statement.

3
  • This seems strange. Could you show the exact code instead of a simplified one to see if there's some reason to it? Commented Feb 20, 2013 at 12:23
  • It appears to be a totally redundant statement, and will have absolutely no effect on the execution of the code. Commented Feb 20, 2013 at 12:23
  • 1
    false is a value, thus it has no effect. It is like writing 23 or "hi"... Commented Feb 20, 2013 at 12:25

2 Answers 2

0

This statement is simply totally useless.

The whole code you show does nothing if some condition has no side effect.

It's probable somebody forgot something, like a return.

Sign up to request clarification or add additional context in comments.

Comments

0

You need to either return the value from a function, or assign it to a variable.

For example:

function myFunction()
{
    if(some_condition)
    {
        return false;
    }
}

or

var my_var;
if(some_condition)
{
    my_var = false;
}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.