Re: Easy Euphoria a Fairy tale

new topic     » goto parent     » topic index » view thread      » older message » newer message
DerekParnell said...

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 blink

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....

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu