Types
SillyScript is built on a handful of core-types.
Booleans
The bool type can only store two options: true or false.
| SillyScript | JSON |
|---|---|
|
SillyScript code:
|
The equivalent JSON:
|
Numbers
There are two number types: int and float. floats can have numbers with decimal places, ints must be integers.
| SillyScript | JSON |
|---|---|
|
SillyScript code:
|
The equivalent JSON:
|
Strings
The string type is a string of characters. At the current moment you can only use double-quotes for strings.
| SillyScript | JSON |
|---|---|
|
SillyScript code:
|
The equivalent JSON:
|
Null
Types can be assigned null to store nothing. When passing null to a typed entry, the type must be “nullable”. A type can be made “nullable” by adding a question mark ? to the end of it.
Non-nullable types can be passed the nullable ones, but the opposite is not true.
| SillyScript | JSON |
|---|---|
|
SillyScript code:
|
The equivalent JSON:
|
List
A list of data entries. A mixed list is denoted with just list.
A list that only contains a single type can be denoted using TYPE list (for example: int list).
| SillyScript | JSON |
|---|---|
|
SillyScript code:
|
The equivalent JSON:
|
Dictionary
An unordered list of data entries with a unique identifier for each entry. A mixed dict is denoted with just dict.
A dictionary that only contains a single type can be denoted using TYPE dict. For example: string dict.
Roles
A “role” can be given to a type as a piece of metadata. This is done using an exclamation point !.
def Something(input: dict!funny) -> dict!sad:
count: input.number
A type with a role can only be passed to another type with the same role identifier.
# Error: dict!sad cannot be passed to dict!funny.
Something(Something({ number: 32 }));