13
submitted 6 months ago* (last edited 6 months ago) by hardkorebob@programming.dev to c/programming@programming.dev

Examples of an interesting computer programming paradigm.

you are viewing a single comment's thread
view the rest of the comments
[-] hardkorebob@programming.dev 2 points 6 months ago* (last edited 6 months ago)
Meta [
	Title:   {Fizz Buzz math "game"}
	Author:  "Kaj de Vos"
	Rights:  "Copyright (c) 2021,2022 Kaj de Vos"
	License: {
		PD/CC0
		http://creativecommons.org/publicdomain/zero/1.0/
	}
	Notes: {
		https://en.wikipedia.org/wiki/Fizz_buzz
		https://wiki.c2.com/?FizzBuzzTest
		https://www.rosettacode.org/wiki/FizzBuzz
	}
]

For counter 100 [                                   ; Count to 100
    Third?: unless modulo counter 3 [write "Fizz"]  ; Display "Fizz" every third count; remember whether we did

    Any [
        unless modulo counter 5 [write "Buzz"]      ; Display "Buzz" every fifth count
        third?                                      ; Remember earlier result
        write counter                               ; Display the number if not third or fifth
    ]
    Write " "                                       ; Separate the displayed items
]
Write new-line
this post was submitted on 13 May 2024
13 points (74.1% liked)

Programming

17314 readers
89 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



founded 1 year ago
MODERATORS