Answers.Body: <blockquote>
    <p>Can I only set an [out] param once?</p>
  </blockquote>
  
  <p>Yes. You cannot tell it to be 2 different values at the same time. This applies to any block, not just the output block.</p>
  
  <blockquote>
    <p>Does setting the [out] param act like the "return" keyword?</p>
  </blockquote>
  
  <p>Not really. The return keyword in most (if not all) programming languages causes the function to exit, which is not the case here. It just allows you to assign the output value (or values - you can have more than one output parameter).</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-05-18T22:34:32.713Z
Answers.LastActivityDate: 2014-05-18T22:34:32.713Z
Answers.UserDisplayName: David Lechner
Answers.Body: <p>I think this is as close as you'll get (other than the constant being set to 99 instead of -1).  You end up with 2 output parameters instead of one.  If you really want only one output, you'll need some logic to determine which to output.</p>
  
  <p><img src="https://i.sstatic.net/z8cZ7.png" alt="A similar MyBlock that returns two output parameters"></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-05-20T02:27:16.993Z
Answers.LastActivityDate: 2014-05-20T02:27:16.993Z
Answers.UserDisplayName: dfrevert
Answers.Body: <p>I don't think I showed a great example. Using David Lechner's advice I changed the code to be more like the below:<img src="https://i.sstatic.net/o7oTV.png" alt="enter image description here"></p>
  
  <p>I use x to store my return value, and when loop 02 is finished, x is copied to the output param.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-05-20T11:32:59.083Z
Answers.LastActivityDate: 2014-05-20T11:32:59.083Z
Answers.UserDisplayName: Simon Featherstone
Body: <p>I have the retail EV3 kit and have created a function with in and out numeric parameters.</p>
  
  <p>While using the [in] params seem quite straight forward, it seems that I can only set the [out] param once. Dragging a second wire from a constant or variable will not connect when I place them. </p>
  
  <p><strong>Can I only set an [out] param once?</strong></p>
  
  <p><strong>Does setting the [out] param act like the "return" keyword?</strong></p>
  
  <p>I have had a look around, but there is very little help on the EV3 My Blocks at present.</p>
  
  <p>Bad, but simple example:<img src="https://i.sstatic.net/rDDXL.png" alt="My Blocks return example"></p>
  
  <p>Please note that this is a simplification of the problem, and in this case I could set x to -1 or have another case in the sensor switch to set x to -1. I am trying to explorer the limitations of EV3 My Blocks out parameters. </p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2014-05-18T21:57:46.793Z
Comments.Text: Can you post a screenshot of the function?
Comments.UserDisplayName: dfrevert
Tags: <ev3><programming><ev3-g>
Title: My Blocks with return parameter
UserDisplayName: Simon Featherstone
ThreadText: # My Blocks with return parameter
  
  (Asked by: username_0 on 2014-05-18)
  
  I have the retail EV3 kit and have created a function with in and out numeric parameters.
  
  While using the [in] params seem quite straight forward, it seems that I can only set the [out] param once. Dragging a second wire from a constant or variable will not connect when I place them.
  
  **Can I only set an [out] param once?**
  
  **Does setting the [out] param act like the "return" keyword?**
  
  I have had a look around, but there is very little help on the EV3 My Blocks at present.
  
  Bad, but simple example:![My Blocks return example](https://i.sstatic.net/rDDXL.png)
  
  Please note that this is a simplification of the problem, and in this case I could set x to -1 or have another case in the sensor switch to set x to -1. I am trying to explorer the limitations of EV3 My Blocks out parameters.
  
  **Tags:** ev3, programming, ev3-g
  > **Comments:**
  > **username_1**: Can you post a screenshot of the function?  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_2 on 2014-05-18. Score: 2 | Accepted answer
  
  > Can I only set an [out] param once?
  
  Yes. You cannot tell it to be 2 different values at the same time. This applies to any block, not just the output block.
  
  > Does setting the [out] param act like the "return" keyword?
  
  Not really. The return keyword in most (if not all) programming languages causes the function to exit, which is not the case here. It just allows you to assign the output value (or values - you can have more than one output parameter).
  
  
  ---
  
  ### Answer by username_1 on 2014-05-20. Score: 0
  
  I think this is as close as you'll get (other than the constant being set to 99 instead of -1). You end up with 2 output parameters instead of one. If you really want only one output, you'll need some logic to determine which to output.
  
  ![A similar MyBlock that returns two output parameters](https://i.sstatic.net/z8cZ7.png)
  
  
  ---
  
  ### Answer by username_0 on 2014-05-20. Score: 0
  
  I don't think I showed a great example. Using David Lechner's advice I changed the code to be more like the below:![enter image description here](https://i.sstatic.net/o7oTV.png)
  
  I use x to store my return value, and when loop 02 is finished, x is copied to the output param.
  
  
  ---
  
  