Created with <3 with dartpad.dev.
Created
June 19, 2023 16:07
-
-
Save onumanfj/31e0cbfe912d644848ba05fe4d0c4f8e to your computer and use it in GitHub Desktop.
dart - function
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
void main() { | |
//call function | |
greet(); | |
greetPerson('Francis'); | |
int result = sumFunc(2,4); | |
print(result); | |
} | |
//named function w/o input or output | |
void greet(){ | |
print('Hello Francis'); | |
} | |
//named function w/ input | |
void greetPerson(String personToGreet){ | |
print('Howdy, $personToGreet.'); | |
} | |
//named function w/ input & output | |
int sumFunc(int num1, int num2){ | |
return num1 + num2; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment