Last active
August 28, 2022 08:18
-
-
Save bluelion79/29f61ae1e97bb0e33685f9968ff68f18 to your computer and use it in GitHub Desktop.
Dart Function Sample
This file contains hidden or 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
| /* | |
| 영신여자고등학교 스토리텔링 작품 | |
| 작품 제목: Circle of Life | |
| */ | |
| String male; //남자 주인공 이름 변수 | |
| String female; //여자 주인공 이름 변수 | |
| int stone; //신비한 돌의 갯수 | |
| double money; //돈 | |
| bool isSick; //건강 | |
| void main() { | |
| male = 'A'; //남자 주인공 이름 설정 | |
| female = 'B'; //여자 주인공 이름 설정 | |
| money = 99.01; //현재 가지고 있는 돈 | |
| isSick = true; //현재 건강 상태(좋은 경우 false, 나쁜 경우 true) | |
| intro(); //이야기 시작 | |
| body(); //이야기 본문 | |
| conclusion(); //이야기 결론 | |
| } | |
| void intro() { | |
| print('$male and $female live in a faraway land.'); | |
| } | |
| void body() { | |
| print('$male and $female live a good life.'); | |
| if (isSick) { | |
| print('But, $male is sick now. So $male and $female go to hospital.'); | |
| print('$male and $female go to hospital.'); | |
| print('$male and $female are getting better day by day'); | |
| } else { | |
| if (money >= 100) { | |
| body1(); | |
| } else { | |
| body2(); | |
| } | |
| } | |
| } | |
| void body1() { | |
| print('$male and $female have $money원 and plan to take a trip.'); | |
| } | |
| void body2() { | |
| print('$male and $female plan to come up with an idea to make money.'); | |
| for (int day = 1; day < 4; day++) { | |
| print('$day day goes by.'); | |
| } | |
| print('Fortunately, $male and $female find a magic stone.'); | |
| stone = 1; | |
| print('Wow! $male and $female now have $stone stone.'); | |
| money = 100.01; | |
| body1(); | |
| } | |
| void conclusion() { | |
| print('$male and $female will live joyfully forever.'); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment