? INCARY ● SmileBASIC Source

Sign In

Register
*Usernames are case-sensitive
Forgot my password
What's going on?? See: Site Update March 2022

INCARY

A function that increments the elements of some array by some value. INCARY NumericArray[],StartingPosition,NumberOfElements,Value DEF INCARY _A[],_P,_LN,V DIM P=MIN(MAX(_P,0),LEN(_A)-1) DIM LN=MIN(_LN,LEN(_A)-P) IF LN==0 THEN RETURN ENDIF DIM A[0]:COPY A,_A,P,LN ARYOP #AOPADD,A,A,V COPY _A,P,A END Doesn't work on strings.
Author
MZ952
Updated
Rating
0 votes
Categories
Keywords
2 Comment(s) chicken chicken Deep Sleep Hidden Website DEF ADDARR ARR[],VA,ST,EL DIM A[LEN(ARR)]:FILL A,VA,ST,EL ARYOP #AOPADD,ARR,ARR,A END MZ952 MZ952 Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Third Year My account is over 3 years old Website Reading I like to read books! Hobbies Haha I knew there was a better way :p Edit: I didn't know FILL accepted those parameters. That makes everything so much simpler. Still, though, you might have to do some bound checking on EL to prevent potential Out of range errors.