2. Dart - Logics

 Just like Golang.


IF/THEN/ELSE/

    if ( variable == 0 ) {

        print("a");

    } else if {

        print("b");

    } else {

        print("c");

    }


Bool Types:

    bool variable = true


    if (variable) {

        print("true");

    }

    this prints true because variable is true.


Switch Cases:

    Variable = "dance"


    switch (variable) {

        case ("dance"):

            print("hello");

            break;

        case ("not dance"):

            print("not hello");

            break;

        default:

            print("default");

    }


While Loops:

    while (variable == 0) {

        do something

    }


    do {

    } while (variable == 1);

    another variation of while loop, but does the function first and check while later.


For Loops:

    for (int a = 5; a <10; a++) {

    }

    for loops lets declare set of rules.


Basic Math Logic Signs:

    ++ 

        increment by 1

    --

        decrease by 1

    +=

        increment by right side values

    -=

        decrease by right side values

    *=

        multiply by right side values

    /=

        divide by right side values

Comments

Popular posts from this blog

2. FreeCodeCamp - Dynamic Programming - Learn to Solve Algorithmic Problems & Coding Challenges

20. Data Analytics - Analyze Data to Answer Questions - Week 1

3. Algorithms - Selection Sort