I'm making sort of a guessing game using the ruby GUI framework Shoes. I am very, VERY new to it and would like to know if it's possible to generate a random integer. In regular ruby, for example, if you wanted to generate a number from one to ten, the code would be
int = 1+rand(10)
Can I use this same code or is there Shoes syntax for this?
Shoes is a Ruby framework. It adds a GUI to Ruby but the code is still Ruby. You could use your code to generate the number. Are you asking how to use that generated number in a widget?
example:
You mention in your comment using
if.. then. You have to specify how you want to use it. Some "if" is built in. So if you what something to happen IF a button is clicked you could:Or if you want to use an
ifstatement for logic you could do this:require 'date'