
reference.language.methods_arguments.html Maven / Gradle / Ivy
Methods
Methods arguments
A Prompto method can accept 0 or more arguments.
Arguments must be declared (there is no implicit argument such as arguments in JavaScript).
When mutiple arguments are declared, they must be separated by commas. In E dialect only, the last comma is replaced by the and
keyword.
Arguments are typed, in one of the following ways:
- Attribute argument, with the form
name
, where name
is an existing Attribute name.
When the attribute is the first argument, it can be automatically extracted from the object:
- Typed argument, with the form
Type x
, where type
is an existing Type name
and x
can be any valid variable identifier.
- Anonymous type attribute argument, with the form
any x with attribute name
, where x
can be any valid variable
identifier and name
is an existing Attribute name. This form accepts more than one attribute.
- Extended type argument, with the form
Type x with attribute name
,
where type
is an existing category name, x
can be any valid variable
identifier and name
is an existing Attribute name. This form accepts more than one attribute.
Mixing argument types
When a method expects mutiple arguments, argument types can be mixed as required.
Default argument values
Prompto supports default argument values, which remove the need to always pass all arguments to a method.
Default argument values must be constant values, i.e. they cannot vary during program execution. Good candidates are literals, null, and enumerated values.
© 2015 - 2025 Weber Informatics LLC | Privacy Policy