Saturday, June 19, 2010

Language – INPUT command (More Details)

Allowing a string expression for the prompt will give flexibility. However, if using a single string variable for the prompt's string expression can lead to possible confusion. Consider these INPUT statements where the variable P$ is meant to contain the prompt string:
INPUT P$;A,B
INPUT P$,A,B
INPUT A$;
For the first statement, it is easy to determine that the P$ is a prompt since a semicolon is separating the prompt from the input variables. However, in the second statement, is the P$ the prompt or is the first of the three variables to input? The later will be assumed because otherwise there would be no way to input a string as the first of two or more variables.

The Translator will determine if the first parameter is a string expression or a string variable by checking if the reference flag of the token is set. The reference flag will not be set for an actual string expression. To override this behavior, the statement can be written as “INPUT (P$),A,B” where the parentheses will clear reference flag of the P$ token forcing it to be interpreted as a string expression and therefore as a prompt.

In the third statement, since no variables follow the semicolon, this statement will be interpreted as inputting a single string variable, keep the cursor on the same line after the input is entered.
I have been doing some reconfiguring/upgrading of my computer (adding a larger and faster hard drive), which didn't go as smooth as it should have. At the same time a board was removed and the system wasn't stable until it's drivers were removed (duh). And there was an error on the system partition that proved to be a great pain to correct until the correct procedure was figured out. Finally the system partition corrected, defragmented and copied to the new hard drive. Work can now continue on this project.