Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8405369
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T22:50:15+00:00 2026-06-09T22:50:15+00:00

Having the following code: function test(x) { if(x==’a’) return false; return true; } if(y

  • 0

Having the following code:

function test(x) {
   if(x=='a') return false;
   return true;
}

if(y ==x) {
    return test('a');
    group['ids']= inputs.val();
    console.log(group);
}

why return true simply breaks my code by not continuing beyond the return?

Note: I want the return test()‘s answer to control if either it should continue with the code OR not

Update

I already do something like:

var response = test('b');
if (response==false) return false;
... more code here ...

But I want to avoid having to do so on every invoke of that function

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T22:50:17+00:00Added an answer on June 9, 2026 at 10:50 pm

    Because that’s what return does in almost every programming language: it

    1. exits the function and
    2. returns a value

    If you need other code to be executed, put it before the return statement.

    Edit: I saw your edit, but it doesn’t change the very nature of return in that (and every) context. It will continue to stop the flow of the current scope, returning to the nearest higher scope with a value (in your case, true or false).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Having the following code class test { private $name; public function __get($name){ return $name;
I am having problems with the following code: function http_file_exists($url){ $f=fopen($url,r); if($f){ fclose($f); return
Just wondering, having the following simple code: var object1 = { name: function (){
The following code is having some problem with the jQuery. <script type="text/javascript"> $(window).load(function() {
I am having the following code: public ActionResult EditTrain(EditTraing editrain) { .... .... return
having a look at the following code: CCSprite* testsprite = [CCSprite spriteWithFile:@test.png]; CCLOG(@1. count:
I got following code: function test () { this.testFunction = function () { //code
I am having problem with the following JQuery code: $(object).hover(function(e){ alert('Flash Here'); }); I
Hi I'm noticing some odd behavior with the following code snippet function test {
I am having trouble with the following code: function initialize() { //myLatLng = new

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.