Skip to content

Latest commit

 

History

History
26 lines (23 loc) · 504 Bytes

File metadata and controls

26 lines (23 loc) · 504 Bytes

Instructions append

Tip

A function with a return type can only return data of that type and null. However the function caller is only expecting one data type.

Example:

String hello(int a){
    if ( a == 0){
        return "a";
    } else {
        return null;
    }
}

To make it more clear that this function can also return null or more data types, use dynamic.

dynamic hello(int a){
    if ( a == 0){
        return "a";
    } else {
        return null;
    }
}