Untitled

mail@pastecode.io avatar
unknown
plain_text
21 days ago
979 B
1
Indexable
Never
//normal function
void main() {
    print(sum(10,50));
}

int sum(int a,int b) {
    return a+b;
}
//same code as lambda function
void main() {
    print("Sum is ${sum(10,50)}");
}

int sum(int a,int b) => a+b;
//some build in function
void main() {
    String text1="Dart";
    String text2="Programming";
    print("Length=${text1.length}");
    print(text1.toUpperCase());
    print(text1.toLowerCase());
    print("$text1 $text2");
}

//oop
class Human {
    void   printHuman() {
        print("Human");
    }
}

class Boys extends Human {
    void printBoy() {
        print("Coder Boy");
    }
}
class Girls extends Boys {
    void printGirl() {
        print("Coder Girl");
    }
}

void main() {
    Human obj1=new Human();
    obj1.printHuman();
    print(" ");
    
    Boys obj2=new Boys();
    obj2.printBoy();
    obj2.printHuman();
    print(" ");
    
    Girls obj3=new Girls();
    obj3.printGirl();
    obj3.printBoy();
    obj3.printHuman();
    print(" ");
}
Leave a Comment