![]() I could have used 'n' instead of 'name' and similarly 'sname' instead of 'surname' but one should always assign a meaningful name to a variable. Be reminded that the variables names 'name' and 'surname' are not called reserved words, but are used by the programmer as variable identifiers. When the program is run and prompts the user to input his name, the name which is keyed in by the user goes directly to its data placeholder in memory called 'name'. Both the name and surname variables are of type string. If we take a look at this program, you might have realized the introduction of a new data type: the String data type. Writeln('Your full name is: ',name,' ',surname) ![]() The following program is written showing an example of a string variable, prompting the user to input his name: Program Lesson2_Program1 Soon, you should learn how to input text by the user using 'string variables'.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |