General FizzBuzz: Difference between revisions
m
→{{header|R}}: Syntax highlighting.
(Added solution for Action!) |
ReeceGoding (talk | contribs) m (→{{header|R}}: Syntax highlighting.) |
||
Line 3,034:
===... solution===
The task asks that we assume 3 factors for the sake of simplicity. However, R makes the k factors case not much more complicated, so we will do that. The only major downside is that checking for malformed user input becomes so difficult that we will not bother.
<lang
{
args <- list(...)
Line 3,055:
===Names solution===
If we deviate from the task's example of how to input parameters and instead use R's names facilities to make our (number, name) pairs, we get a much cleaner solution.
<lang
{
factors <- sort(namedNums)#Required by the task: We must go from least factor to greatest.
|