Difference between revisions of "Talk:Return"

From Second Life Wiki
Jump to navigation Jump to search
(New page: Scenario: Function in 2 seperate branches of "IF" calls a function returning an integer. Execution of the script is NOT ALWAYS returned to the point calling for a return value. <pre> int...)
 
(Removing all content from page)
Line 1: Line 1:
Scenario: Function in 2 seperate branches of "IF" calls a function returning an integer.
Execution of the script is NOT ALWAYS returned to the point calling for a return value.


<pre>
integer IsTrue( string SomeValue )
{
  if( SomeValue == WhatImLookingFor )
  {
      return TRUE;
  }
  return FALSE;
}
</pre>
Simple enough ..
<pre>
SomeOtherFunction( string SomeParameter, integer ANumber )
{
  if( ANumber == 1 )
  {
    if( IsTrue( SomeParameter ) )
    {
        llSay( 0, "FOO" );
    }
  {
  if( ANumber == 2 )
  {
      if( IsTrue( SomeParameter ) )
      {
          llSay( 0, "FUBAR" );
      }
  }
}
</pre>
Also fairly clear what should happen... BUT . Suppose ANumber = 2 and IsTrue  does indeed return TRUE!!  (OMG!)
The output of this set of functions seems to never **EVER** say "FUBAR".
Given that ANumber = 2 and IsTrue( SomeParameter ) returns TRUE -->>  This script will say "FOO" and should not.
Any Clues?

Revision as of 12:34, 21 February 2009