Changes

Jump to: navigation, search

GPU621/Chapel

8 bytes removed, 22:27, 29 November 2022
Procedure
*Similar to the inout intent, the ref intent causes the value of the actual to change depending on the function. However, while the inout copies the argument in upon entering the function and copies the new value out upon exiting, using a ref intent causes any updates to the formal to immediately affect the call site.
*The out intent causes the actual argument to be ignored when the procedure starts. The actual is assigned the value of the corresponding formal when the routine exits.
=== Class ===
Like C++, the prime allows the user to create a new type that can contain variables and constants, called fields, as well as functions and iterators called methods. A new class type is declared using the class keyword.
class C {
}
}
=== Record ===
A record type can be declared using the record keyword. A record is a type that can contain variables and constants, called fields, as well as functions and iterators called methods. Records have many similarities to classes, but there are several important differences:
*Records do not support inheritance and virtual dispatch
}
=== Special Methods ===
*An initializer named init is called when creating an instance of the class or record.
*A method named init= is called a copy initializer and accepts a single argument.
*The writeThis and readThis methods allows user to read or write the instance.
=== Nothing Variable ===
The primer demonstrates the use of the nothing type. A nothing is removed by the compiler and doesn’t exist during program execution. The value none has type nothing and can be assigned to a nothing variable, or returned from a function with nothing return type.
var nothingVar: nothing;
73
edits

Navigation menu