Types and Values

Types

Rockstar uses a similar type system to that defined by the ECMAScript type system, except undefined doesn’t sound very rock’n’roll so we use mysterious instead.

  • Number - Numbers in Rockstar are fixed-precision , stored according to the IEEE 754 standard. (An earlier version of this spec proposed that Rockstar used the DEC64 numeric type. This is a perfect example of something that seemed like a great idea after a couple of beers but turns out to be prohibitively difficult to implement…)
  • Boolean - a logical entity having two values true and false.
    • rightyes and ok are valid aliases for true
    • wrongno and lies are valid aliases for false
  • Function - used for functions.
  • Null - the null type. Evaluates as equal to zero and equal to false. The keywords nothingnowherenobody, and gone are defined as aliases for null
  • Mysterious - the value of any variable that hasn’t been assigned a value, denoted by the keyword mysterious.

Strings

Rockstar strings are surrounded by double quotes. A string literal includes everything up to the closing quote, including newlines. To include a double quote in a string, use a pair of double quotes. Rockstar strings are stored internally as UTF-16, and support the full Unicode character set.

The keywords emptysilent, and silence are aliases for the empty string ("")

Print "this is a string literal"

Print "This string includes ""quotes"""

Print "This string
contains
line
breaks"

Print "Стріляй!
Скажи, чому боїшся ти
Зробити цей останній крок?"

Print "🎸✨🎆💔🌃🐍💘🌾🍾"

Print empty

Print silence

Numbers

Number literals are written as ordinary digits; decimals and negative numbers are supported:

Print 1 (prints: 1)
Print 0.5 (prints: 0.5)
Print +8 (prints: 8)
Print -10 (prints: -10)
Print -.4 (prints: -0.4)
Print 1.000000000 (prints: 1)
Print 1.2. (prints: 1.2)

A Rockstar number is a 128-bit fixed-precision decimal, between -79,228,162,514,264,337,593,543,950,335 and +79,228,162,514,264,337,593,543,950,335.

You get 29 digits, a minus sign if you need it, and a a decimal point you can put anywhere you like:

Print   +79228162514264337593543950335
(prints: 79228162514264337593543950335)
Print    -79228162514264337593543950335
(prints: -79228162514264337593543950335)

Print   +0.0000000000000000000000000001
(prints: 0.0000000000000000000000000001)
Print     -.0000000000000000000000000001
(prints: -0.0000000000000000000000000001)

Print   +10000000000000.000000000000001
(prints: 10000000000000.000000000000001)
Print    -10000000000000.000000000000001
(prints: -10000000000000.000000000000001)

Numbers with more than 29 digits will be rounded to 29 digits if they have a decimal part:

Print   +1000000000000000.00000000000001
(prints: 1000000000000000)
Print    -1000000000000000.00000000000001
(prints: -1000000000000000)

Print   +79228162514264337593543950335.1
(prints: 79228162514264337593543950335)
Print    -79228162514264337593543950335.1
(prints: -79228162514264337593543950335)

Print +0.00000000000000000000000000001 (prints: 0)
Print -0.00000000000000000000000000001 (prints: 0)

Booleans

Rockstar supports the Boolean literals true (aliases: yes, ok, right) and false (aliases: no, wrong, lies).

Print true (prints: true)
Say OK (prints: true)
Scream yes (prints: true)
Shout right (prints: true)
 
Print false (prints: false)
Say no (prints: false)
Shout wrong (prints: false)
Scream lies (prints: false)

Null

Rockstar null represents an expression which has no meaningful value. Aliases for null are nothing, nowhere, nobody and gone:

Print null (prints: null)
Say nothing (prints: null)
Scream nowhere (prints: null)
Shout nobody (prints: null)
Say gone (prints: null)