Giter Site home page Giter Site logo

simple-loops-prework's Introduction

Simple Loops

Instructions

  1. Fork and clone this lab. Then, open it in sublime and run the test suite with the learn or rspec command.
  2. This lab requires you to write a series of methods that use the different looping constructs we've covered in this unit. Read the comments in simple_looping.rb. This is the file where you'll be coding your solution. The comments will help you to solve the lab and get the tests passing.
  3. Each method takes in an argument of an integer. If you call one of the methods with an argument of 4, your method should loop and puts out a phrase 4 times. If you call the same method with an argument of 10, your method should loop and puts out that phrase 10 times.
  4. As you move through the lab, think about the differences between the looping constructs you're utilizing. What are some advantages to using certain constructs? Disadvantages?
RSpec โ€” A Closer Look:

Take a look at your spec/simple_looping_spec.rb file. You'll notice on line 4 that there is a before(:each) do statement. What is this? This is what's called a before hook. What this is doing is taking the code that is inside the before hook's block and executing it at the start of each test (denoted by the it keyword). For example, this:

it "prints out some witty statement from the 1990's" do
  @say_my_name = "Oh snap, Destiny's Child!"
  expect(@say_my_name).to eq("Oh snap, Destiny's Child!")
end

can be accomplished by this:

before(:each) do
  @say_my_name = "Oh snap, Destiny's Child!"
end

it "prints out some witty statement from the 1990's" do
  expect(@say_my_name).to eq("Oh snap, Destiny's Child!")
end

Resources

View Simple Loops on Learn.co and start learning to code for free.

simple-loops-prework's People

Contributors

irmiller22 avatar markedwardmurray avatar fs-lms-test-bot avatar sophiedebenedetto avatar annjohn avatar snags88 avatar sarogers avatar fislabstest avatar humzahchoudry avatar joshuabamboo avatar msuzoagu avatar

Watchers

James Cloos avatar  avatar

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.