Ruby first line of code

Source: Internet
Author: User

Main.rb
#= Guess numbers#这是一个简单的猜数字游戏#== Gameplay#随机生成一个 The natural number of "1,100", it will prompt the sizeClass Guessnum def playGame wrongint =truec =0    Num= Rand -     whileWrongint c+=1Puts"Please enter the number you guessed" 0~100 ""Getnum = getsifGetnum.to_i <NumPuts"small guess."elsif getnum.to_i >NumPuts"big guess."      ElsePuts"U Got it! #{c} times are common. "Wrongint =false      End    End  EndEndNewgame = Guessnum.NewNewgame.playgame
Run

Ruby Main.rb

/users/baodong/.rvm/rubies/ruby-2.2.0/bin/ruby- e $stdout. sync=true;$stderr. sync=true; Load ( $=argv.shift)/USERS/BAODONG/RUBYMINEPROJECTS/GUESSNUMBER/MAIN.RB Please enter the number you guessed "0~ -』 -Please enter your guess number "0~ -』 -Guess small Please enter the number you guessed "0~ -』 +Guess small Please enter the number you guessed "0~ -』 -Guess small Please enter the number you guessed "0~ -』 $Please enter your guess number "0~ -』 -Guess small Please enter the number you guessed "0~ -』 -Please enter your guess number "0~ -』 WuU Got it! public.8Times. Process finished withExitCode0
Generate doc

RDoc main.rb

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Ruby first line of code

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.