Exercise 1: First Data Entry Class
Click here to return to the exercise description in the main part of the tutorial.
Start VS Code, and create a new class. Use ObjectScript for the package name and DataEntry1 for the class name. You'll see this code:
Class ObjectScript.DataEntry1 { }
Copy code to clipboardWithin the {}, create the Main() method.
Class ObjectScript.DataEntry1 { /// first data entry method ClassMethod Main() { } }
Copy code to clipboardEnter the following ObjectScript into the method:
read !, "Name: " , name if name = "" { quit } // user entered nothing read !, "Phone: ", phone read !, "DOB: ", dob // display the data write !!!, "Name:", ?20, name write !, "Phone:", ?20, phone write !, "DOB:", ?20, dob
Copy code to clipboardClick the Save and Compile buttons.
Start the Terminal, and run your method, by typing do ##class(ObjectScript.DataEntry1).Main().