Values

Value #

Values are the built-in atomic object types that all other objects are composed of. They can be created through literals, expressions that evaluate to a value. All values are immutable—once created, they do not change. The number 3 is always the number 3. The string “frozen” can never have its character array modified in place.

Boolean Values #

They are just two values of boolean : tien and galon, they are instance of Tienya class.

Number Values #

Like other scripting languages, Mosc has a single numeric type: double-precision floating point. Number literals look like you expect coming from other languages:


0
29919
-21991
0.122911
-23411
0x123DEF
0b1110110001
0o217761

Numbers are instances of Diat class.

Strings #

A string is an array of bytes. Typically, they store characters encoded in UTF-8, but you can put any byte values in there, even zero or invalid UTF-8 sequences. (You might have some trouble printing the latter to your terminal, though.)

String literals are surrounded in double quotes:

"molo"
""

Strings can also span multiple lines. The newline character within the string will always be \n (\r\n is normalized to \n).


"
Aw
nin 
tié
"

Escaping #

A handful of escape characters are supported:

"\0" # The NUL byte: 0.
"\"" # A double quote character.
"\\" # A backslash.
"\%" # A percent sign.
"\a" # Alarm beep. (Who uses this?)
"\b" # Backspace.
"\e" # ESC character.
"\f" # Formfeed.
"\n" # Newline.
"\r" # Carriage return.
"\t" # Tab.
"\v" # Vertical tab.


"\x48"        # Unencoded byte     (2 hex digits)
"\u0041"      # Unicode code point (4 hex digits)
"\U0001F64A"  # Unicode code point (8 hex digits)

A \x followed by two hex digits specifies a single unencoded byte:

A.yira("\x48\x69\x2e") # gives Hi

A \u followed by four hex digits can be used to specify a Unicode code point:

A.yira("\u0041\u0b83\u00DE") # gives: AஃÞ

A capital \U followed by eight hex digits allows Unicode code points outside of the basic multilingual plane, like all-important emoji:

A.yira("\U0001F64A\U0001F680") # gives: 🙊🚀

Strings comes from Seben class.

Interpolation #

String literals also allow interpolation. If you have a dollar sign ($) followed by a block({}) expression or an identifier, the expression is evaluated. The resulting object’s sebenma method is called and the result is inserted in the string:

A.yira("Molo san ye ${12 + 3} ye")

Since the interpolation is block of expression you can have inside it a string that have also an interpolation.

Raw String #

You can also create a string using triple quotes """ , such strings are exactly the same as any other string, but are parsed differently - they are kept the way you write them, that’s to say no escape or interpolation are note handled.

"""
    nin map = {
        "togo": "Molo",
        "age": 12
    }
    nin a = 20
    nii a > 10 {
        A.yira("A > 20")
    }
"""

Note that, in above example, trailing spaces are kept. Raw strings are the best place to insert script code in strings.

Ranges #

A range is a little object that represents a consecutive range of numbers. They don’t have their own dedicated literal syntax. Instead, the number class implements the .. and ... as a mean operators to create them:

1..4

This creates a range from 1 to 4 including 4 it-self.

4...100

This creates range from 4 to 100 not including 100 it-self.
Ranges are commonly used in iteration over sequences of numbers, but are useful in other places too. You can pass them to a list‘s index operator to return a subset of the list, for example, or on a String, the substring in that range:

nin walan = ["a", "b", "c", "d", "e"]
nin slice = walan[1..3]
A.yira(slice) // gives: [b, c, d]

nin seben = "hello mosc"
nin mosc = seben[-4..-1]
A.yira(mosc) // gives: mosc

Ranges are instance of Funan

Null #

Mosc provides special value gansan for null values which is the only instance of Gansan class. Can be seen as voidin some languages, it indicates an absence of value. Methods or function that do not explicitly return a value, return implicitly gansan.