? RETURNing from GOSUB inside a function does not work correctly (Page 1) ● SmileBASIC Source Forums

Sign In

Register
*Usernames are case-sensitive
Forgot my password
Another contest? You asked for it!

RETURNing from GOSUB inside a function does not work correctly

  • #1 ✎ 1305 12Me21 Admin Syntax Highlighter Received for creating the code syntax highlighter on SBS Night Person I like the quiet night and sleep late. Express Yourself On the other thread, someone idiot pointed out that RETURN doesn't work as you'd expect in functions that return things: DEF EXAMPLE() GOSUB @TEST RETURN "666" @TEST RETURN END PRINT EXAMPLE()This gives an uninitialized variable used error at the second RETURN. However, if you give a value that is the same type as the real return value: DEF EXAMPLE() GOSUB @TEST RETURN "666" @TEST RETURN "" END PRINT EXAMPLE()Then it will work just as expected. Posted Edited by 12Me21
  • #2 ✎ 78 banana RNG Hidden Easter Eggs Disguised Hidden Website Expert Programmer Programming no longer gives me any trouble. Come to me for help, if you like! Programming Strength someone? you bastard Posted