Simple Expressions
A list and short description of all simple expressions in the default language specification.
This page contains a list of the simple expressions in the skript language specification. Complex or unusual expressions have their own dedicated pages.
Syntax provided by external libraries is not documented here.

Comparisons

Contains

%Object% contains %Object%
Check whether the first object contains the second. Applies to strings, lists and collection types.
Returns a boolean value.
1
assert "hello" contains "h"
2
if {list} contains 3:
3
print "hello"
Copied!

Exists

%Object% (exists|is set)
Check whether the value exists (is not null.)
Returns a boolean value.
1
assert "hello" exists
2
if {var} is set:
3
print "hello"
Copied!

Greater Than

%Number% (is greater than|>) %Number%
Check whether the first number is greater than the second.
Returns a boolean value.
1
assert 4 > 3
2
if {var} is greater than 3:
3
print "hello"
Copied!

Greater Than or Equal To

%Number% (is greater than or equal to|>=) %Number%
Check whether the first number is greater than or equal to the second.
Returns a boolean value.
1
assert 4 >= 4
2
if {var} is greater than or equal to 3:
3
print "hello"
Copied!

Less Than

%Number% (is less than|<) %Number%
Check whether the first number is less than the second.
Returns a boolean value.
1
assert 4 < 5
2
if {var} is less than 3:
3
print "hello"
Copied!

Less Than or Equal To

%Number% (is less than or equal to|<=) %Number%
Check whether the first number is less than or equal to the second.
Returns a boolean value.
1
assert 4 <= 4
2
if {var} is less than or equal to 3:
3
print "hello"
Copied!

Is Array

%Object% (is|are) an array
Check whether the value is an array. This is separate from the of type syntax because the internal name for array is objects.
Returns a boolean value.
1
assert (1, 2) is an array
2
if {var} is an array:
3
loop {item} in {var}:
4
print {item}
Copied!

Is of Type

%Object% (is|are) a[n] %Type%
Check whether the value is of the given type.
Returns a boolean value.
1
assert "hello" is a string
2
if {var} is a string:
3
print {var}
Copied!

Equals

%Object% (is|is equal to|=|==) %Object%
Check whether the two values are equal. This uses the superficial equals check and is safe to compare strings and numbers with. For a strict reference equivalent check, use the strict equals function.
Returns a boolean value.
1
assert "hello" is "hello"
2
if {var} is 4:
3
print "hello"
Copied!

Not Equal

%Object% (isn't|aren't|is not|are not|≠|!=) %Object%
Check whether the two values are not equal. This uses the superficial equals check and is safe to compare strings and numbers with. For a strict reference equivalent check, use the strict equals function.
Returns a boolean value.
1
assert "hello" is not "goodbye"
2
if {var} is not 4:
3
print "hello"
Copied!

Event Details

Current Event

[the] [current] event
The current event, if this process was started by an event call. This is usable anywhere within the program, but will return null if the process was not started by an event trigger.
This can be used to retrieve event-specific values.
Returns an event.
1
assert event exists
2
if event exists:
3
print "this was triggered by an event"
Copied!

Execution

Result of Executable

[the] result of %Executable%
Retrieves the result of an executable, such as a supplier lambda or a dynamic function. This will run the executable and provide its object value.
If used on a runnable lambda or a no-return function, the value will be null.
Returns an object.
1
set {var} to result of {function}
2
set {var} to result of a new supplier:
3
return 6
4
assert {var} is 6
Copied!

Runnable

[a] new runnable
See here for details on using this syntax.

Supplier

[a] new supplier
See here for details on using this syntax.

Function Call

function_name(args...)
See here for details on using this syntax.

External Function Call

function_name(args...) from skript/file
See here for details on using this syntax.

Dynamic Function Handle

[the] function %String%
See here for details on using this syntax.

Helper

These helper expressions provide clarity but no actual execution side-effects.

Brackets

(%Object%)
Used for assuring the inner expression is evaluated first when the order of operations is unclear. This is especially useful in maths expressions, since ByteSkript takes order of compilation over order of operations (and does not obey BIDMAS.)
Be careful not to confuse this with the implicit array creator (a, b, c)!
Returns whatever is inside.
1
set {var} to (5 + 6)
2
set {var} to (1 + (7 * 5)) / 3
Copied!

Generic

A set of miscellaneous expressions providing useful values.

Current Script

[the] [current] script
Provides the qualified path name of the current script in the format skript/path/name. This is the format used by the dynamic function expression.
Returns a string.
1
set {name} to the current script
2
assert {name} contains "skript"
3
print {name}
Copied!

Java Version

[the] java version
Provides the java version number that this script was compiled with. Note: the JVM may be running a higher java version.
Returns a number.
1
set {ver} to the java version
2
assert {ver} is 61 // java 17
3
print {name}
Copied!

New Line

(new[ ]line|nl)
Returns the line break for the current system ( or \r etc.)
Returns a string.
1
print "hello" + newline + "there"
Copied!

System Input

[the] (system|console) input
Reads the next line from the command-line console as a string. Useful for requesting input for the user in command-line applications, but may be useless for non-command-line applications.
This is a blocking effect.
The script will wait until an input is provided by the user.
Returns a string.
1
print "What's your name?"
2
set {input} to the system input
3
print "Hello " + {input} + "!"
Copied!

System Property

[the] system property %String%
Edits the system property with the given key. This expression supports getting, setting and deleting.
Returns a string.
1
set system property "blob" to "hello"
2
assert system property "blob" is "hello"
3
delete system property "blob"
Copied!

Type

type
Provides the class object of a type from its type name. Some example type names are shown below:
  • string
  • number
  • integer
  • object
  • list
  • executable
  • error
Third-party libraries may register additional types.
These type names refer to the ones used in %Input% inputs in syntax. Types may inherit each other, and all types inherit object.
Not all types are provided as simple named expressions. You can also obtain the value using the get_class function.
Returns a class.
1
assert "hello" is a string
2
assert get_class("java.lang.Object") is object
Copied!

Collections

A set of expressions relating to collection types (lists, maps, arrays, etc.)

Implicit Array Creator

(%Object%, %Object%, ...)
Creates an unmodifiable array with the given arguments in. Useful for creating in-line collections for loops and function calls.
An array is a special type of collection with a fixed size.
Returns an array.
1
set {array} to (1, 2, 3)
2
loop {number} in {array}:
3
print {number}
Copied!

Explicit Array Creator

[a] new array of (%Object%, %Object%, ...)
Creates an unmodifiable array with the given arguments in. Useful for creating in-line collections for loops and function calls.
An array is a special type of collection with a fixed size.
Returns an array.
1
set {array} to a new array of (1, 2, 3)
2
loop {number} in {array}:
3
print {number}
Copied!

New List

[a] new list
Creates a modifiable list. This can hold any type of object.
Returns a list.
1
set {list} to a new list
2
add 1 to {list}
3
add "hello" to {list}
4
loop {thing} in {list}:
5
print {thing}
Copied!

New Map

[a] new map
Creates a modifiable map. This can hold any type of object in a key - value structure.
Returns a map.
1
set {map} to a new map
2
set "key" in {map} to 5
3
set "hello" in {map} to "goodbye"
4
assert "hello" in {map} is "goodbye"
5
loop {value} in {map}:
6
print {value}
Copied!

Index of List

index %Number% in [list] %List%
Returns the value at the given index of the list. If this index is greater than the size of the list (- 1) an error will be thrown.
List indices start at zero.
Returns an object.
1
set {list} to a new list
2
add 1 to {list}
3
add "hello" to {list}
4
assert index 0 of {list} is 1
5
assert index 1 of {list} is "hello"
Copied!

Key in Map

%Object% in [map] %Map%
Returns the value for the given key in the map. If the map has no entry for this key, it will return null. This may be set to a value.
Returns an object.
1
set {map} to a new map
2
set "key" in {map} to 5
3
assert "key" in {map} is 5
Copied!

Size of Collection

the size of %Object%
Returns the size of the list, map, array, etc.
Returns a number.
1
set {list} to a new list
2
add 1 to {list}
3
add "hello" to {list}
4
assert size of {list} is 2
Copied!

Otherwise

Binary Otherwise

%Object% (otherwise|?) %Object%
Returns the first entry if it exists (not-null) otherwise the second entry.
Returns one of the two objects.
1
assert ("hi" ? "bye") is "hi"
2
assert (null ? "bye") is "bye"
3
assert (null ? null) is null
4
if ({var} otherwise 5) is greater than 3:
5
print "hello"
Copied!

Ternary Otherwise

if %Boolean% then %Object% otherwise %Object%
%Boolean% ? %Object% : %Object%
If the boolean is true, returns the first entry. If the boolean is false, returns the second entry.
Returns one of the two objects.
1
set {var} to true ? "hello" : "goodbye"
2
assert {var} is "hello"
3
​
4
set {var} to false ? "hello" : "goodbye"
5
assert {var} is "goodbye"
6
​
7
set {var} to (if {cond} then 1 otherwise 6)
Copied!