Created
March 5, 2019 04:58
-
-
Save timsully/f5a098c3676e77310d64dab58c68545e to your computer and use it in GitHub Desktop.
PEDAC Process
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
=begin | |
Problem | |
Write a method that takes two arguments, a string and a positive integer, and | |
prints as many times as the integer indicates. | |
PEDAC, Breaking Down the Problem: | |
Inputs: | |
- takes two arguments | |
- a string and a positive integer | |
Implicit Rules: | |
- none that i could find? | |
Outputs: | |
- prints string as many times as the integer indicates | |
Mental Model: | |
Create a method that takes two arguments. The first argument being the string, | |
and the second argument being an integer. The integer will be the indicator of | |
how many times the string argument will print. | |
Examples / Test Cases | |
Validation | |
* Note that we derive our examples from our rules | |
------------------------ | |
Example 1 | |
Inputs | |
- String: "Hello" | |
- Integer: 1 | |
Output | |
- "Hello" | |
------------------------ | |
------------------------ | |
Example 2 | |
Inputs | |
- String: "Hello" | |
- Integer: 2 | |
Output | |
- "HelloHello" | |
------------------------ | |
=end | |
def repeat(string, int) | |
puts string * int | |
end | |
repeat('Hello', 1) #=> Hello | |
repeat('Hello', 2) #=> HelloHello | |
repeat('Hello', 3) #=> HelloHelloHello |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment