Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Day1 Advpl problem FizzBuzz #347 #356

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,17 @@
"doc",
"code"
]
}
},
{
"login": "diogenesdauster",
"name": "Diógenes Dauster",
"avatar_url": "https://avatars2.githubusercontent.com/u/16214631?s=460&u=c397c372c3332d4c5a16a79f4cb5e1141c88bc8e&v=4",
"profile": "https://github.com/diogenesdauster",
"contributions": [
"doc",
"code"
]
}
],
"commitConvention": "none"
}
19 changes: 19 additions & 0 deletions Day1/Advpl/fizzbuzz.prw
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
User function fizzbuzz(num)
Local result := ""
Local i := 1

For i := 1 To num

If i % 3 = 0 .and. i % 5 = 0
result += "FizzBuzz "
Elseif i % 5 = 0
result += "Buzz "
Elseif i % 3 = 0
result += "Fizz "
EndIf

Next

alert(result)

return result
33 changes: 33 additions & 0 deletions Day1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -624,6 +624,39 @@ fun fizzBuzz (fizzList: List<Int>) {

fizzBuzz((1..15).toList())
```
## Advpl Implementation

### [fizzbuzz.prw](./Advpl/fizzbuzz.prw)

```advpl

/*
The Fizz Buzz Challenge
Autor: Diógenes Dauster <[email protected]>
GitHub: https://github.com/diogenesdauster
Date: 17/11/2020
*/

User function fizzbuzz(num)
Local result := ""
Local i := 1

For i := 1 To num

If i % 3 = 0 .and. i % 5 = 0
result += "FizzBuzz "
Elseif i % 5 = 0
result += "Buzz "
Elseif i % 3 = 0
result += "Fizz "
EndIf

Next

alert(result)

return result
```

### Have Another solution?

Expand Down