enrique and many others are using Hackety Hack to learn how to code.

Hackety Hack is a free program for Windows, Mac OS X and Linux that can teach you how to make games, applications and more and share those programs with your friends. You can ask other budding programmers questions and follow them to see what code they're working on through the Hackety Hack website.

Sign up Learn More

dice_withclear by enrique

# Dice roller with result replacing previous roll
# Trick is that 'para' automatically adds a new paragraph
#  and so we can clear the @results box and then put the 
#  number into it.
# See 'Nobody Knows Shoes' by _why (PDF pages 46-47)

Shoes.app do
    button "d20" do
      @results.clear do
        number = 1+rand(20)
        para number
      end
    end
  @results = stack :margin=>20, :width=>50
end