Skip to content

Instantly share code, notes, and snippets.

View topex-psy's full-sized avatar
:octocat:
Working on my new project

Taufik Nur Rahmanda topex-psy

:octocat:
Working on my new project
View GitHub Profile
@topex-psy
topex-psy / main.dart
Last active April 4, 2023 03:30
Dart 5. Enum & Switch Case
void main() {
var spacecraft = Spacecraft("Roket 101", type: SpacecraftType.lander, launched: DateTime.tryParse("2022-01-02"));
spacecraft.launchDate = "2021-01-02";
spacecraft.describe();
}
enum SpacecraftType {
flyby,
orbitter,
lander,
@topex-psy
topex-psy / main.dart
Last active March 27, 2023 04:00
Dart 4. Function, Class & Method
void main() {
double kuadrat(double n) {
return n * n;
}
print(kuadrat(20));
var spacecraft = Spacecraft("Roket 101", launched: DateTime.tryParse("2022-01-02"));
spacecraft.launchDate = "2021-01-02";
spacecraft.describe();
@topex-psy
topex-psy / main.dart
Last active March 24, 2023 02:48
Dart 3. Control Flow Statements
void main() {
String? nama = "Taufik";
const umur = 20;
double? tinggi = 175.436537;
bool? isMarried;
bool isHasJob = true;
final jobs = <String>["Programmer", "Web Developer", "Software Engineer"];
final bio = {
"Nama": nama ?? "Anonim",
"Umur": "$umur tahun",
@topex-psy
topex-psy / main.dart
Last active March 21, 2023 04:03
Dart 2. Constant & Nullable
void main() {
var nama = "Taufik";
const umur = 20;
final double? tinggi;
bool? isMarried;
bool isHasJob = true;
final jobs = <String>["Programmer", "Web Developer", "Software Engineer"];
// tidak bisa karena constant
// umur = 25;
@topex-psy
topex-psy / main.dart
Created March 21, 2023 03:02
Dart 1. Variabel
void main() {
String nama = "Taufik";
int umur = 20;
double tinggi = 175.35464;
bool isMarried = false;
bool isHasJob = true;
String bio = """
Hello, I'm Taufik
I am Software Engineer
""";