How to resolve the algorithm FizzBuzz step by step in the YAMLScript programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm FizzBuzz step by step in the YAMLScript programming language
Table of Contents
Problem Statement
Write a program that prints the integers from 1 to 100 (inclusive).
But:
The FizzBuzz problem was presented as the lowest level of comprehension required to illustrate adequacy.
Let's start with the solution:
Step by Step solution about How to resolve the algorithm FizzBuzz step by step in the YAMLScript programming language
Source code in the yamlscript programming language
map(say):
map:
- fn (x):
s =:
str:
- (zero? mod(x 3)) ?: "Fizz"
- (zero? mod(x 5)) ?: "Buzz"
if (empty? s): x, s
- (1 .. 100)
map(say):
map:
- fn (x):
???:
zero?(mod(x 15)) : "FizzBuzz"
zero?(mod(x 5)) : "Buzz"
zero?(mod(x 3)) : "Fizz"
:else: x
- (1 .. 100)
map(say):
loop [i 1, l []]:
if (i > 100):
- l
- ^^^:
- inc(i)
- conj:
- l
- ???:
zero?(mod(i 15)) : "FizzBuzz"
zero?(mod(i 5)) : "Buzz"
zero?(mod(i 3)) : "Fizz"
:else: i
You may also check:How to resolve the algorithm Wireworld step by step in the J programming language
You may also check:How to resolve the algorithm Truncate a file step by step in the Mathematica/Wolfram Language programming language
You may also check:How to resolve the algorithm Binary digits step by step in the NetRexx programming language
You may also check:How to resolve the algorithm Identity matrix step by step in the IS-BASIC programming language
You may also check:How to resolve the algorithm String prepend step by step in the Prolog programming language