Re: Easy Euphoria a Fairy tale
- Posted by irv Jun 15, 2015
- 3518 views
By the way, this could have been written up in the Wiki using creole markup rather than HTML.
Anyhow ... here is a more generic (and nicer?) version of the final code
include std/console.e integer a = 3 integer b = 5 integer c = 100 for i = 1 to c do if remainder(i,a * b) = 0 then display("FizzBuzz") elsif remainder(i,a) = 0 then display("Fizz") elsif remainder(i,b) = 0 then display("Buzz") else display(i) end if end for
Don't know Creole.
You're right about the above code being more generic and nicer - but that wasn't my goal. I was trying to see Euphoria from the standpoint of someone who knew little or nothing about programming, except for perhaps some Basic from the days when dinosaurs ruled the earth.
Such a person would most likely try print - and finding it wouldn't work, would look that up in the docs. There's no reference to display there - just "see also" ? and puts. Below print he would find printf, with "see also" sprint and sprintf.
display, as a key word, could potentially have all sorts of meanings other than putting characters on the screen. Display an image? Set the terminal lines and characters? etc....