? Functions allowing extra arguments (Page 1) ● SmileBASIC Source Forums

Sign In

Register
*Usernames are case-sensitive
Forgot my password
Space-Restriction Challenge QSP Phase Ends on March 26!

Functions allowing extra arguments

  • #1 ✎ 1696 12Me21 Syntax Highlighter Received for creating the code syntax highlighter on SBS Night Person I like the quiet night and sleep late. Express Yourself Some functions allow extra inputs, which are ignored: VSYNC 1,2,3,4,5,6,7,8,9,10 WAIT 1,2,3,4,5,6,7,8,9,10 And others also allow unlimited outputs (which are all null): PCMCONT 1,2,3,4,5,6,7,8,9,10 OUT ,,,,,,,,,,,,,, '(and all other PCM functions) Posted
  • #2 ✎ 1696 12Me21 Syntax Highlighter Received for creating the code syntax highlighter on SBS Night Person I like the quiet night and sleep late. Express Yourself This also means that there are a few more "ignore" functions: X=POP(A) 'fastest (only works with one type) PCMSTOP POP(A) 'requires DLC IF POP(A) THEN ENDIF 'only works with integers and strings WAIT 0,POP(A) PLEASE POP(A) 'slowest(Obviously you shouldn't actually use those since this is a bug that might be fixed) And a function that returns null: PCMSTOP() Posted Edited by 12Me21
  • #3 ✎ 198 MZ952 Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Drawing I like to draw! Hobbies Reading I like to read books! Hobbies DIM X X=PCMSTOP > OK DIM X X=PCMSTOP() > Uninitialized variable used in 0:2 Posted
  • #4 ✎ 606 IAmRalsei Forum Leader Hidden Achievements First Year My account is over 1 year old Website Expert Programmer Programming no longer gives me any trouble. Come to me for help, if you like! Programming Strength
    DIM X X=PCMSTOP > OK DIM X X=PCMSTOP() > Uninitialized variable used in 0:2
    I don't think this has anything to do with this thread but okay
    Posted
  • #5 ✎ 198 MZ952 Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Drawing I like to draw! Hobbies Reading I like to read books! Hobbies Well, it's an odd behavior. Edit: also, not sure if any other function can do this, but PCMCONT OUT PCMCONT 0 OUT > OK OUT with no outputs normally gives an error. Also, during my testing of this: DEF T OUT END > Out of code memory in 0:1 Haven't seen that one before. Posted Edited by MZ952
  • #6 ✎ 1696 12Me21 Syntax Highlighter Received for creating the code syntax highlighter on SBS Night Person I like the quiet night and sleep late. Express Yourself "Uninitialized variable used" is the error you get when trying to assign null to a variable. X= isn't a syntax error, it's actually X=(null). When SB expects a value but gets nothing, you get null. That's how functions with "empty" arguments work. LOCATE X, is just LOCATE X,(null), or LOCATE X,PCMSTOP() ("null" isn't an official name, it's just what we've been calling it) X=PCMSTOP is just treating PCMSTOP as a variable (variables and functions in SB can have the same names, and whether something is a variable or a function depends on context) Any function can be called as FUNCTION args OUT outputs, even if there are 0 outputs. For some reason DEF doesn't let you do that, though. Posted Edited by 12Me21
  • #7 ✎ 198 MZ952 Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Drawing I like to draw! Hobbies Reading I like to read books! Hobbies Somewhat news to me, do we have a page on it? (Edit: on the any Function arg Out opts) Also, looks like you just can't define a function like that. DEF T END T OUT > OK Ah, looks like I'm redundant here sadface Posted Edited by MZ952
  • #8 ✎ 1696 12Me21 Syntax Highlighter Received for creating the code syntax highlighter on SBS Night Person I like the quiet night and sleep late. Express Yourself https://smilebasicsource.com/forum?ftid=1124 Posted