With how SmileBASIC handles programs, you can (Most of the time) easily compress programs.
Like this:LOCATE 0,0
PRINT "TEST 123123123"
I$=I$+"12345"LOCATE.,.?"TEST "+"123"*3INC I$,"12345This works because:
- It detects . as a number (Probably the same reason as .5 is the same as 0.5)
- It runs DEFs under: A-Z and 0-9, but not .
- When there's not another separator (,), it treats it as a newline
- INC is just ARG1=ARG1+ARG2, still works with strings because of how variables are handled
- When making something, try not compressing a lot of it, in case you easily want to change something
- : makes a newline, handy for some SB commands are optional arguments (Including PRINT/? if they have no arguments):ACLS:?"12345" 'ACLS [GR, SP, FN]
- DEC won't work as INC, because it's ARG1=ARG1-ARG2.
- DEFs also won't include these: !, &, SPACE/CHR 0 and @ but variables can be defined with #
- If a line starts with :, it will return a syntax error
- You don't need to close a string on a newline, but not : (e.g. ?"123)
- Anything after a ' (Or REM) on a line will be a comment
These can only be replaced if it's a simple true/false operation (e.g. #TRUE&&#TRUE #TRUE||#FALSE)
- OR can be replaced with ||
- AND can be replaced with &&
- NOT can be replaced with !
- DIV can be replaced with /
- #WHITE or RGB(255,255,255) is just -1
- If you want to know what a value is (e.g. RGB(127,63,255)), then just type in ? then the command in DIRECT mode and use the shortest one (#LIME or -16713728)
- IF will always execute if it's not 0
- TRUEand FALSE are just 1 and 0
- To invert a boolean (TRUE or FALSE), use NUM=!NUM
- If you use something like STR$[NUM] , it will return the equilivant of: MID$(STR$,NUM,1), but if it's greater than the length of the string, it would return a Subscript out of range
- If a return call is not made in a DEF (e.g. RETURN NUM), it will cause a Type mismatch
- If a return call return to nothing, it will cause a Syntax error (This also happens with "123"STR$(NUM))
- If there's code in the same line as the IF statement, then the command will only run one line until ENDIF (Only when a newline has been specified with CHR 10)
- "123"*NUM is probably the same reason as how INC works with strings
Examples: (One per line)CLS?"Hello, "+USR$
IF LEN(S$)THEN ?"TEST"