Talk:Return
Revision as of 09:42, 21 February 2009 by Melany Lunasea (talk | contribs) (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...)
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.
integer IsTrue( string SomeValue ) { if( SomeValue == WhatImLookingFor ) { return TRUE; } return FALSE; }
Simple enough ..
SomeOtherFunction( string SomeParameter, integer ANumber ) { if( ANumber == 1 ) { if( IsTrue( SomeParameter ) ) { llSay( 0, "FOO" ); } { if( ANumber == 2 ) { if( IsTrue( SomeParameter ) ) { llSay( 0, "FUBAR" ); } } }
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?