Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Variables

Creating Variables

In Solstice, you can initialize a variable using the syntax:

name = value

where:

  • name is the name of your variable. You can use all letters in variable names, as well as underscores and numbers.
    • The standard way to name your variables in Solstice is with camelCase.
  • value is some sort of value. This value can be:
    • an integer (number with no decimal place)
    • a double (number with a decimal place)
    • a string (collection of characters, as seen before)
    • a character (a single letter)
    • a boolean (either true or false)

We’ll look at types of values in the next part.

Recalling Variables

Recall a variable’s content by using it’s name:

puts name

where name is the name of your variable.