Data update
This commit is contained in:
parent
72eb4943cb
commit
4d5544505c
2347 changed files with 62432 additions and 16731 deletions
|
|
@ -0,0 +1,23 @@
|
|||
import ballerina/io;
|
||||
|
||||
// Person is an 'open' record type which allows fields of 'anydata' type
|
||||
// to be added at runtime.
|
||||
type Person record {
|
||||
string name;
|
||||
int age;
|
||||
};
|
||||
|
||||
public function main() {
|
||||
// Create an instance of Person with an additional 'town' field.
|
||||
Person p = {
|
||||
name: "Fred",
|
||||
age: 40,
|
||||
"town": "Boston" // extra field name needs to be in quotes
|
||||
};
|
||||
|
||||
// Print name and age fields - using standard '.' syntax.
|
||||
io:print(p.name, " is ", p.age);
|
||||
|
||||
// Print the additional field - using a map-like syntax.
|
||||
io:println(" and lives in ", p["town"], ".");
|
||||
}
|
||||
|
|
@ -19,7 +19,7 @@ public program()
|
|||
|
||||
object.foo := "bar";
|
||||
|
||||
console.printLine(object,".foo=",object.foo);
|
||||
Console.printLine(object,".foo=",object.foo);
|
||||
|
||||
console.readChar()
|
||||
Console.readChar()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue