Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

Beginner Ruby Challenges

ruby

  • Please log in to reply
2 replies to this topic

#1 Tamachan87

Tamachan87

    CC Lurker

  • Just Joined
  • Pip
  • 2 posts

Posted 30 January 2012 - 03:57 AM

I've been teaching myself Ruby for less than a week at the moment. I've been going back and forth between a few tutorials; some go really slow, some go too fast (assuming I've learnt coding before) and some go way to bizarre (Why's Poignant Guide). I feel like I need to give myself some direction with this.

I've self-taught myself enough HTML and CSS with the tiniest bit of JavaScript picked up from CodeCademy. I really want to learn a full language so I chose Ruby.

What's some good challenges for myself to figure out? Could anyone recommend some ideas that are good for beginners (ie. make a clock?).


Thanks!

PS.:-P
I know how to loop a puts command, but how would I have it do it slowly (ie. once a second) and how would I be able to set a key to break the loop?
  • 0

#2 phillip1882

phillip1882

    CC Lurker

  • New Member
  • Pip
  • 6 posts
  • Programming Language:C, Java, Python, Ruby
  • Learning:Lisp

Posted 01 August 2012 - 05:45 PM

t0 = Time.new
values = t0.to_a
while true
    t1 = Time.new
    values2 = t1.to_a
    if (values[0]-values2[0]).abs > 10 then
	  print t1.hour,":", t1.min,":", t1.sec,"\n"
	  t0 = Time.new
	  values = t0.to_a
	  x = gets.chomp
	  if x == "Q" or x == "q"
		 break
	  end
   end
end

is one way to code your clock app.
  • 1

#3 brbcoding

brbcoding

    CC Regular

  • Member
  • PipPipPip
  • 33 posts
  • Location:Florida
  • Programming Language:Java, C#, PHP, Python, JavaScript, Ruby, PL/SQL
  • Learning:Perl, Ruby

Posted 25 August 2012 - 01:34 PM

I work out problems on Project Euler and on Daily Programmer once I've learned the basics of a language... That seems to help me apply it and think of projects to work on.
  • 1





Also tagged with one or more of these keywords: ruby