Download BASIC comparison sheet
Transcript
Commands Vendor Model HP TI HP-75 HP-71B with HP-IL N/A 'LABEL', LABEL ON ... GOTO/GOSUB Available IF ... THEN ... THEN is mandatory. Nested IF CC-40 N/A IF ... THEN ... ELSE ... Program flow TI-74 Alphanumeric(8) with ' ': Same syntax as file names. Labels Syntax for branch targets besides line numbers Commands Available. N/A Only after ELSE. Allowed, nearest ELSE belongs to nested IF. Multiline IF ... ENDIF WHILE ... WEND N/A REPEAT ... UNTIL SWITCH ... CASE ... ENDSWITCH Subroutines FOR I=1 TO 2 STEP -1 NEXT I Loop not executed, I=1 after loop. Variable name on NEXT Mandatory Function and position of END Executable command anywhere in program. Closes all local files and deallocates local variables. Substitutes END SUB in subroutine. Returns from CALLed external Executable command anywhere in program. Closes all open files. Allowed even program. after SUBEND. Executable from keyboard. HP-75 : not executable from keyboard. Local procedure definition besides GOSUB/RETURN Use DEF FN or external file. SUB name(params) Name follows label syntax. SUB name(params) Name follows variable syntax. Return from procedure END, END FN END SUB, END or next SUB. SUBEND. SUBEXIT returns early. Variable scope Parameters of FNX() and variables in external program are local. Variables are local. Files are local, if no parameter list is defined. Call and parameter passing X=FNY(...) CALL 'file' CALL name(R,A,(V),#C ) CALL file Recursion Fully implemented. ON ERROR command ON ERROR GOTO/GOSUB Error line and error code ERRL, ERRN ERRL, ERRN, ERRM$ Error handling Disable error handler N/A Debugging BASIC comparison sheet OFF ERROR ON ERROR STOP DEFAULT ON/OFF/EXTEND, TRAP handle math exceptions. PAUSE (STOP acts like END) CONT target N/A CALL ERR(CODE,TYPE,FILE,LINE) RETURN, RETURN NEXT, RETURN line number TRACE FLOW/VARS/OFF turn tracing on/off. Suspend execution Continue after STOP, break key or break point ON ERROR line number RETURN if command is GOSUB. ON TIMER #n,seconds,commands OFF TIMER #n More event handling CALL name(Reference,Array(),Matrix(,),(Value)) N/A ON ERROR Return from error handler All variables are local. ATTACH/RELEASE name,... handle preallocation and allow variable persistence. All variables are local. CONT or SST key Commands ON WARNING PRINT/NEXT/ERROR ON BREAK STOP/NEXT/ERROR BREAK/UNBREAK line,line,... set or clear breakpoints. BREAK (STOP acts like END) CON/CONTINUE line number Page 25