Giter Club home page Giter Club logo

parrot-ruby's Introduction

Parrot Lab

Objectives

  1. Define a method that accepts arguments.
  2. Create a default argument.
  3. Practice returning a value.

Instructions

In this lab you'll be defining a method called #parrot.

The #parrot method should accept an argument of a string and both #puts out that string and return the string at the end of the method.

The #parrot method should have a default argument of "Squawk!".

Note: This lab is explicitly testing your ability to control the return value of a method, not just what it does, but what it returns. Remember, return values are important. Ask yourself? what is the return value of #puts?

Resources

parrot-ruby's People

Contributors

ahimmelstoss avatar aviflombaum avatar deniznida avatar fislabstest avatar fs-lms-test-bot avatar ihollander avatar jmburges avatar joshuabamboo avatar kthffmn avatar loganhasson avatar markedwardmurray avatar maxwellbenton avatar sarogers avatar sophiedebenedetto avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

parrot-ruby's Issues

The lab is lacking an indicator for "Fork", "Run", and "Submit".

Excuse me for "parroting" the same issue, but somehow this lab has the "I'm Done" button (as though this were a README or Code-Along), instead of the "Fork", "Run", and "Submit" indicators. The rest of it still works properly.

Thank you for looking into this, and my apologies for the pun.

Squawk

Maybe this was intentional, but nowhere in the lesson or parrot.rb comments does it mention that the default phrase must be "Squawk!". That doesn't become clear until a user either checks the content of the test or runs Learn and sees the error message.

Parrot Clarification

So how does one read the Parrot error messages and understand what they have to do the first time around?

Here is the error message:

#parrot
should say "Squawk!" by default (FAILED - 1)
should return the default phrase
should output the given phrase (FAILED - 2)
should return the given phrase

Failures:

1) #parrot should say "Squawk!" by default
Failure/Error: expect($stdout).to receive(:puts).with("Squawk!")
(#).puts("Squawk!")
expected: 1 time with arguments: ("Squawk!")
received: 0 times
# ./spec/parrot_spec.rb:6:in `block (2 levels) in '

2) #parrot should output the given phrase
Failure/Error: expect($stdout).to receive(:puts).with("Pretty bird!")
(#).puts("Pretty bird!")
expected: 1 time with arguments: ("Pretty bird!")
received: 0 times
# ./spec/parrot_spec.rb:18:in `block (2 levels) in '

Finished in 0.00772 seconds (files took 0.09245 seconds to load)
4 examples, 2 failures

Failed examples:

rspec ./spec/parrot_spec.rb:5 # #parrot should say "Squawk!" by default
rspec ./spec/parrot_spec.rb:17 # #parrot should output the given phrase

And there is the code that is sufficient to solve it:

def parrot(say = "Squawk!")
    puts say
    return say
end

I solved this lab after really reading into what the instructions ask and a little help from the error messages but I found this really mysterious. Why are there references to "Pretty bird!" when that isn't necessary to pass this lab? Very confusing. I feel like I just stumbled around in the dark until I was lucky enough to write the correct string of code.

Should I no longer expect explicit instructions and stare at the error messages until a lightbulb goes off?

Please advise.

"local tests not run"

The green light for having run local tests, won't light up.
I did the lab 3 times, getting all tests green, using Learn and then Learn Submit.

I also did it using clone/fork/add/push method.

I've created 2 pull requests, but the "local tests button" on the Learn page is still not turning green. I'll move to the next lesson for now.

Issue showing parrot lesson as a completed lab

I just completed the parrot-ruby lab but in my curriculum it doesn't show up as completed. It just looks like it is an article you press "done reading", instead of the usual "fork", "test", "submit.

screen shot 2018-08-05 at 10 33 12 am

Refresh to see 'Next Lesson'

On this and a few other lessons, I need to refresh the page after completing the Pull Request in order to get the 'Next Lesson' option.

prints and returns readme

I got tripped up here bc my method worked but only half the tests were passing... until i re-read instructions and saw the "method will output that phrase, but also return the phrase"

Would be helpful to link students back to https://learn.co/tracks/web-development-with-ruby-on-rails/ruby/adding-new-words-to-your-program/puts-and-return-values as a refresher in case they need help (prob not necessary in immersive bc they do it at once but i got to this lab 2 days after i read that readme.)

"return" value

when running the test it should work with or without the word: return

It took me a while to figure out that you wanted that specific command in my rb file. I was suprised because the lessons have been stating that methods return your last expression.

So if there is a way so it also accepts it without the "return"

def parrot(phrase="Squawk!")
puts phrase
phrase
end

Return Values Lab not connected to IDE correctly

The Return Values Lab in the "Variables and Methods" section of Procedural Ruby is marked as a lab, opens a lab in IDE, but seems to operate as an informational lesson. I get the "I'm done" button. After I mark the lesson as done, it does seem to connect back and says "Completed This Lab."

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.