AMPed a Web Dev Adventure blog by amarkpark

Epiphany

#YouKnowYoureAWebDeveloperWhen A quick static page accidentally becomes a multipage Bootstrapped site w/ header logo and content in ver 1.1

That was my “Ah Ha!” moment

I had been revising what should have been a simple static page with a few lines of text on it for HOURS, happily diving down the rabbit hole in order to resolve a few issues I had and adding “just one more thing…” “just one more thing…” until my single simple HTML page had become a sleek multi-page app with a header and a child page and a logo and content all nicely arranged just so in Bootstrap.

By the end of the day I was composing three different methods to describe a dog’s tail wagging in Ruby and I was thinking of boiling water in terms of a Ruby method.

Coding is my heroine.

I feel a lot like Remo Williams right about now: “The Adventure Begins”

~AMP

# method 1 works

puts "Number of wags?"
wags = gets.chomp.to_i

def tailwags(wags)
	if wags % 2 == 0
		puts "right"
	else
		puts "left"
	end
end

while wags > 0
	tailwags(wags)
	wags = wags - 1
end


# method 2 works

puts "Number of wags?"
wags = gets.chomp.to_i

def tailwags(wags)
	while wags > 0
		if wags % 2 == 0
			puts "right"
		else
			puts "left"
		end
		wags = wags - 1
	end
end

tailwags(wags)


# method 3 works

puts "Number of wags?"
wags = gets.chomp.to_i

def tailwags(wags)
	if wags % 2 == 0
		return "right"
	else
		return "left"
	end
end

while wags > 0
	puts tailwags(wags)
	wags = wags - 1
end