Created
October 27, 2020 09:09
-
-
Save ballerina-github-bot/dbf9784f6141aadf81f12e9279147365 to your computer and use it in GitHub Desktop.
Ballerina Playground
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ballerina/io; | |
type Student record { | |
string firstName; | |
string lastName; | |
int intakeYear; | |
float gpa; | |
}; | |
public function main() { | |
Student s1 = { firstName: "Michelle", lastName: "Sadler", intakeYear: 1990, | |
gpa: 3.5 }; | |
Student s2 = { firstName: "Ranjan", lastName: "Fonseka", intakeYear: 2001, | |
gpa: 1.9 }; | |
Student s3 = { firstName: "Martin", lastName: "Guthrie", intakeYear: 2002, | |
gpa: 3.7 }; | |
Student s4 = { firstName: "George", lastName: "Fernando", intakeYear: 2005, | |
gpa: 4.0 }; Student[] studentList = [s1, s2, s3, s4]; | |
string[] students = from var student in studentList | |
where student.gpa >= 2.0 | |
select student.firstName + " " + student.lastName + "\n"; io:println(students); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment