From: Jean-Julien Fleck on
Hello,

> I don't even know how to use goto's.

Concerning GOTO's, there is a little comic I really like:

http://xkcd.com/292/

:o)

--
JJ Fleck
PCSI1 Lycée Kléber

From: hazal Ates on
Thiago Massa wrote:
> Just define a function like "play_game" and do a loop that gets the
> input in
> order to play the game or not and calls that function.
>
> I don't even know how to use goto's.
>
> 2010/7/26 hazal Ates <niyaziates77(a)gmail.com>

thank you TM and others ;

let me give an example what i want in Pascal code :

writeln('continue ? // finish game =====> y / n ');
writeln;
readln(k);
if (k='E') or (k='e')
then
goto (begining of prog.);

can you give an example to run same code in ruby ?
--
Posted via http://www.ruby-forum.com/.

From: hazal Ates on
hazal Ates wrote:
> >>
>> 2010/7/26 hazal Ates <niyaziates77(a)gmail.com>
>
> thank you TM and others ;
>
> let me give an example what i want in Pascal code :
>
> writeln('continue ? // finish game =====> y / n ');
> writeln;
> readln(k);
> if (k='E') or (k='e')
> then
> goto (begining of prog.);
>
> can you give an example to run same code in ruby ?

change the line like ; if (k='Y') or (k='y')
--
Posted via http://www.ruby-forum.com/.

From: Giampiero Zanchi on
def menu
p "Write a number"
p "Q to stop"
the_replay = gets.chomp
end

def do_exit
p "Bye bye"
exit
end

while 1 == 1 do
the_reply = menu
case the_reply
when "q" then do_exit
when "Q" then do_exit
end
p the_reply
end
--
Posted via http://www.ruby-forum.com/.

From: hazal Ates on
Giampiero Zanchi wrote:
> def menu
> p "Write a number"
> p "Q to stop"
> the_replay = gets.chomp
> end
>
> def do_exit
> p "Bye bye"
> exit
> end
>
> while 1 == 1 do
> the_reply = menu
> case the_reply
> when "q" then do_exit
> when "Q" then do_exit
> end
> p the_reply
> end

thank you G. Z.
i use your codes to my problem.
--
Posted via http://www.ruby-forum.com/.

First  |  Prev  | 
Pages: 1 2
Prev: ruby calc.rb or just calc.rb
Next: writing binary file