At this point you should understand:
Check your understanding by doing the following exercises:
- that load 'debug' loads debug utilities
- the general idea of verb debugging
- how control words create control structures by grouping sentences into blocks
- what the T block test result is
- how the test result determines which B block to execute
- how the test result determines when control structure execution is finished
- debug step through your convert verb
- create a temporary script file and define a verb called conv that is similar to convert, but insists on a 'f' argument to do the conversion to Fahrenheit and gives a string result indicating there was an error if the left argument is neither 'c' nor 'f'. Hint: use the control structure sketched out here:
if. x = 'c' do. ...
elseif. x = 'f' do. ...
elseif. 1 do. 'left arg not c or f'
or try a select. structure.
create a temporary script file and define a dyad called plus that adds its left argument to its right. But, if there is an error, it should give a string result. Hints: use dyad : 0; 4 plus 9 should return 13; 'a' plus 9 should return your error string (perhaps, 'there was an error'); use a try. control structure to catch the error and give the string result.