On 24 November 2016 at 21:50, Nathan Guilty <ruby / e-solutions.re> wrote:

> This doesn't work :
>
> 1/ Set the name
> Case 1 : If the name is empty so, i need to have "Let's play Guest!"
> Case 2 : If the name is quit, i need to have "Goodbye Guest."
> Case 3 : A real player name, i need to have "Let's play #{@name}"
>
> :)
>
>
My brief sketch of an algorithm would be:

1. initialise the name to "Guest"
2. read a word from the user (into a local variable, not @name)
  2.a) if it's "Quit", go to end
  2.b) otherwise if it's not empty, assign it to @name
3. play




-- 
  Matthew Kerwin
  http://matthew.kerwin.net.au/
(supressed text/html)
Unsubscribe: <mailto:ruby-talk-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>