Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
NotificationsYou must be signed in to change notification settings

learn-co-students/ttt-1-welcome-rb-v-000

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Overview

We're going to build a simple program that implements only the very first thing a complete Tic Tac Toe program would require, which is to greet the player with a welcome message.

Objectives

  1. Read the output from runninglearn.
  2. Useputs to print "Welcome to Tic Tac Toe!"
  3. Have tests pass locally by runninglearn.
  4. Submit solution.

Instructions

  1. Runlearn
  2. Read output.
  3. Code solution inlib/welcome.rb
  4. Runlearn
  5. Read output.
  6. If still broken, repeat 3-5
  7. If passing, submit withlearn submit

Troubleshooting

Here are some things you can try to get more clues to solve the lab.

1. Try runningruby lib/welcome.rb

When you runruby lib/welcome.rb from your terminal you are asking the Ruby interpreter to run your program. If you see no output, like below, that means there is no code inlib/welcome.rb to print "Welcome to Tic Tac Toe!".

Note: The filewelcome.rb already exists in the folderlib, but is not displayed in Learn IDE default view.

No Puts

The solution to this is to make sure you haveputs "Welcome to Tic Tac Toe!" inlib/welcome.rb. A working program should look like:

Working program

Note: Contrary to the workflow of the previous lesson, it is NOT necessary to create a new file to contain the 'puts` instruction.

Hint: Make sure you've savedlib/welcome.rb.

2. Make sure you're printing "Welcome to Tic Tac Toe!" exactly.

When you runlearn you might see failing tests even though your program seemingly works. The failures might read something like:

1) lib/welcome.rb prints "Welcome to Tic Tac Toe!"   Failure/Error: load './lib/welcome.rb'     #<IO:0x007fa2b28325a0> received :puts with unexpected arguments       expected: ("Welcome to Tic Tac Toe!")            got: ("Welcome to Tic Tac Toe")   # ./lib/welcome.rb:4:in `puts'

An error like this is telling you that the test expects you to print"Welcome to Tic Tac Toe!", but you printed something else. Programming is absolutely precise, make sure your tests are printing exactly "Welcome to Tic Tac Toe!".

ViewWelcome Message for Tic Tac Toe on Learn.co and start learning to code for free.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors5

Languages


[8]ページ先頭

©2009-2025 Movatter.jp