Tutorial Overview and The Basics
Welcome to the ObjectScript Tutorial!
ObjectScript is a procedural language with distinctive features, the most notable of which is a powerful and flexible data model and storage engine, called globals. InterSystems IRIS® data platform provides multiple data models and APIsOpens in a new tab for developers. ObjectScript and globals are at the core of it all!
The tutorial has three parts:
-
Part 1 (Tutorial Overview and The Basics, the part you've already started) covers standard language elements and introduces using Visual Studio Code with the InterSystems ObjectScript extensions.
-
Part 2 (The Good Stuff) covers string and list handling, arrays, and introduces globals.
-
Part 3 (Using Globals) covers globals in depth. It also contains a brief introduction to objects, properties, instance methods, and SQL queries.
You should proceed sequentially through the pages in each part using the table of contents on the left. You can also use the links to the previous and next pages at the bottom of each page.
During this tutorial you will write methods (in class definitions) that use many of the features of ObjectScript. You'll use Visual Studio Code (VS Code) as the Integrated Development Environment (IDE). The InterSystems ObjectScript and Language Server extensions allow you to connect VS Code to an IRIS server and use it to edit, compile, and debug ObjectScript. This tutorial uses VS Code - ObjectScript to refer to VS Code with the extensions installed. Learn more by reading VS Code - ObjectScriptOpens in a new tab documentation. You can also do the exercises using the older IDE, Studio (Windows only), but the tutorial assumes you're using VS Code - ObjectScript.
There will also be examples of using commands and functions shown using the ObjectScript Shell. You should freely experiment with these examples, coming up with variations of your own.
The best way to learn ObjectScript is to do the hands-on exercises that are included throughout this tutorial. In the first few exercises, you'll write code to collect, validate, and store basic data for persons. In later exercises, you'll write code for looking up persons and editing or deleting their data. There are also step-by-step solutions to each exercise, available when you click this picture on an exercise page.

All of the classes used in examples and exercises are available on GitHub in the Samples-ObjectScriptOpens in a new tab repository. You can connect VS Code to the repository, or download the repository and add the classes to your VS Code workspace. Read Downloading Samples for Use with InterSystems IRIS for general information about samples on GitHub.
Typical InterSystems IRIS installation uses the Normal or Locked Down security settings option. In this case, using the Terminal, VS Code - ObjectScript, and the Management Portal requires you to authenticate. Alternatively, installation using the Minimal security settings option allows you to use the tools without authenticating.
The rest of Part 1 of the tutorial explains the basic commands of ObjectScript, which are similar to those in other programming languages.
Here's what you'll learn:
-
What an InterSystems IRIS class definition looks like, and how to write class methods.
-
How to use VS Code - ObjectScript, the Terminal, and the ObjectScript Shell.
-
ObjectScript commands: Write, Read, Set, Kill, Do, Quit, Return, and Continue, including post-conditional and argumentless versions.
-
ObjectScript constructs: If, For, While, Do/While, Try/Catch.
-
Proper syntax, and some common errors you may encounter.
Review the ObjectScript Reference for more information on ObjectScript commands and functions (use your browser's Back button to return here).
Click the Class Methods link below to continue.