vi studio

Lessons · The language · 5 of 36

Comments and names

# comments, <# blocks #> and snake_case names.

A # starts a comment that runs to the end of the line. <# … #> holds a comment over several lines. Vi ignores comments; they are notes for people.

<# A greeting card.
   This comment spans three lines. #>
main greeting_card:
  color: blue[50]          # a light blue background
  arrange: center
  children:
    greeting_text:
      text: "Hello from Vi!"
      text_style: 22

Names are lowercase words joined with underscores: greeting_card, add_task, high_score. A name says what the thing is or does. Vi tells the kinds of names apart by how they are written:

Written like It is Example
name = value a variable (data) score = 0
name(…): + statements a function (work) add_point():
name: + attributes a container (something on screen) header:

Every example here runs in Vi Studio: open it in your browser (phones too) and press Start learning on the welcome page. Each code block there has a Try it button that runs it in the phone preview.

More in The language

About Vi. Vi is a free, open-source programming language for building real mobile apps. You describe each screen in plain words, and Vi compiles it to React Native (Expo) for Android, iOS and the web. Its editor, Vi Studio, runs on Windows, in any browser and on your phone, with the app running live as you type. Read more about Vi.