Giter Site home page Giter Site logo

looping-while-until's Introduction

The while and until Constructs

Objectives

  1. Build a method that uses while
  2. Build a method that uses until

Using while and until

It's our first year at Hogwarts and we're struggling to master the levitation charm, "Wingardium Leviosa". Currently, we have a levitation force of 6. We need to have a levitation force of 10 in order to actually levitate that feather.

First, we'll write a while loop that will continue to puts the phrase "Wingardium Leviosa" while our levitation force is less than 10. Every time we puts that phrase, we should increment our levitation force by 1.

Then, we'll solve this again by using an until loop. It will puts the phrase "Wingardium Leviosa" until the levitation force is equal to 10, incrementing the levitation force by 1 each time we puts the phrase.

Instructions

  1. Run the test suite in this lab to get started.

  2. Let's get the first test passing by coding our solution in while.rb: Fill out the content of the using_while method so that calling it will puts the desired phrase while your levitation force is less than 10. Remember, every time you puts the phrase, you should increment your levitation force by 1.

  3. Let's get the second test passing by coding our solution in until.rb: Fill out the content of the using_until method to puts the desired phrase, "Wingardium Leviosa", until our levitation force equals 10. Remember, every time you puts the phrase, you should increment your levitation force by 1.

Hint: If you get stuck an infinite loop when you run your tests or your code, you can abort the test run or code by pressing CONTROL+C on your keyboard.

looping-while-until's People

Contributors

annjohn avatar aviflombaum avatar cthulhu-uu avatar dfenjves avatar ihollander avatar jmburges avatar joshuabamboo avatar lizbur10 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

looping-while-until's Issues

Inconsistent indentation between while.rb and until.rb

until.rb uses eight spaces for its indentation, whereas while.rb uses one tab.

Issue #16 first reported this issue as having four spaces, but commit 32799c8 that supposedly fixes it replaced it with eight spaces instead of one tab like in while.rb.

Ruby convention seems to favor two spaces for indentation. For beginners, the inconsistency can be confusing.

this example was never given

Remember our long and repetitiously-counting code that used if statements to count from 0 to 20? Well, we can refactor that into simple, readable, short code with the while construct:

(nope, I don't remember.)

Error in Looping-While-Until lab

I'm getting an error occurs while loading after hitting "learn"

An error occurred while loading ./spec/until_spec.rb.
Failure/Error: require_relative "../lib/until.rb"

0 examples, 0 failures, 2 errors occurred outside of examples

Do we want to introduce or provide links to while and until syntax?

Looks to me like we're asking people to use while and until loops, but in the previous class when we introduced loops we didn't provide either of those syntaxes. Is this a deliberate "time for you to guess/google it", were those syntaxes mentioned earlier in the curriculum and/or is this not a problem because people are getting through it?

Not saying we should change this, but wanted a placeholder so we could have a conversation about it . . .

Lab message

When I clicked the "Open IDE" button and the lab opened, there was a prompt stating I was opening a lesson past the point where I was in the curriculum. I clicked Yes and looked at the ReadMe compared to the website and they were the same lesson.

Not Forking

I solved the lab and the passed the test but the lab didn't fork

Levitation Charm?

In the "USING WHILE AND UNTIL" it says "Guess what? We're still struggling to master that levitation charm! But we are so close...."

Seems like this lab is referring to a previous example (or I guess "Wingardium Levios" is a levitation charm?). Worth clarifying a bit.

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.