Code Monkey home page Code Monkey logo

looping-loop's Introduction

The loop Construct

Objectives

  1. Understand how the loop construct works
  2. Build a method that utilizes the loop construct

Introduction

The first looping construct that we'll discuss is loop. This is the simplest looping construct that we have in Ruby. It simply executes a block (the code that is between the do and end keywords). Try this in IRB in your Terminal:

loop do
  puts "I have found the Time Machine!"
end

This will output I have found the Time Machine! an infinite number of times in your Terminal. Use Control+C to break out of the loop in your terminal.

Instructions

This is the first in a series of short exercises to help you get the hang of looping constructs.

  1. There are no tests for this lab, so code your solution in looping.rb:

    • It's your first class in driving school and you're trying to remember important rules of the road. Fill out the content of the method looping to contain a loop that puts the phrase "Never pass a school bus if it has flashing red lights" an infinite number of times.

    • Beneath your method definition, call your method by typing the name of the method, looping.

  2. Then, run the file by typing ruby looping.rb in your terminal from the directory of this lab. You'll be stuck in an infinite levitation loop! Hit Control+C to exit the infinite loop.

looping-loop's People

Contributors

annjohn avatar drakeltheryuujin avatar ihollander avatar markedwardmurray avatar maxwellbenton avatar sarogers avatar sophiedebenedetto 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-loop's Issues

Can't fork labs beyond "Looping - Loop Constructor"

I can't seem to fork this lab and any labs past.

I get the following error message:

Looking for lesson...
WARNING: You are attempting to open a lesson that is beyond your curr
ent lesson.
Are you sure you want to continue? [Yn]:

Seems like other people may be running into the same issue. Please help! Thank you =]

Lab repo can't be found

When I click open on this lesson I get this: Looking for lesson... WARNING: You are attempting to open a lesson that is beyond your current lesson. Are you sure you want to continue? [Yn]: Y Opening readme... logout [Process completed] *Then it takes me to the learn website and says Lesson "Looping Lab" is unpublished

Screenshot from Nitrous:

screen shot 2015-11-16 at 2 21 10 pm

this is a new reading/repl

This is NOT a repl b/c repl can't test puts. I'm re-doing all looping repls as short and simple labs.

These are not ready to deploy as soon as I get some ๐Ÿ‘€

@jmburges

Looping Lab Wording Confusion

The instructions say "There are no tests for this lab, so code your solution in looping.rb" which can lead to people looking for that looping.rb file. The file does not exist as this lab only uses the SANDBOX and the student has to create the file. To avoid confusion it should be said that the file needs to be created.

Problem when I hit "Open"

When I hit Open, the terminal opens and I get the following error:

Last login: Fri Nov 6 18:48:06 on ttys000
/tmp/tmp_open.sh ; exit;
[18:49:42] ~
// โ™ฅ /tmp/tmp_open.sh ; exit;
Looking for lesson...
WARNING: You are attempting to open a lesson that is beyond your current lesson.
Are you sure you want to continue? [Yn]: y
Opening readme...
logout

[Process completed]
It also opens another tab that contains this error:
Lesson 'Looping Lab' is unpublished.

Thanks!

Control + C does not exit out of an infinite loop!

Please update the README for this lab. Despite what the instructions say at the bottom, "Ctrl C" will not exit out of the infinite loop when you run "ruby looping.rb". As far as I can tell, the only way to exit out of the infinite loop is to refresh the page.

Thank you for looking into this!
Sdcrouse

LOOPING - LOOP CONSTRUCTOR

This lesson did not open properly for me when I tried to fork the lab. It gives me this message in the terminal:

Looking for lesson...
WARNING: You are attempting to open a lesson that is beyond your current lesson.
Are you sure you want to continue? [Yn]:

The following lesson opens properly.

Trouble Opening the Looping Lab

Finished the previous lesson, made typical motions to commence next lesson using the Learn app. All seemed well-- the forking, the cloning-- but then received terminal warning that I am "attempting to open a lesson that is beyond your current lesson. Are you sure you want to continue? [Yn]"

I ignore the error and input "Y," but then am redirected to a page (https://learn.co/lessons/13157) that indicates that the Looping Lab has not yet been published. This page invites me to continue on to the next lesson-- the Looping Lab. Sending me into a loop of my own...

Have tried cloning and opening manually (i.e. via my terminal), but no dice.

Lesson is broken

Lesson lists itself as unpublished. It cannot be forked but not opened.

It says WARNING: You are attempting to open a lesson that is beyond your current lesson.
Are you sure you want to continue? [Yn]:

It doesnt make sense but even if I say Y it bring me to another screen that doesnt have a lesson. This should be looked at.

Thank you

"No spec file"

There seem to be two versions of this exercise:

looping-loop-v-000 (which is what you get when clicking on Nitrous from the lesson)

and

looping-loop-001-prework-web (which is what I got if I click on GitHub from the lesson)

Problem is: looping-loop-v-000 doesn't run in Nitrous: "This directory doesn't appear to have any specs in it."

Looping - Loop Constructor

I have completed all the previous exercises and when I try to open this lab I get the following error.

You are attempting to open a lesson that is beyond your current lesson.
Are you sure you want to continue? [Yn]:

When I press Y, it directs me to the Learn Web Development Fundamentals where it says:

You do not have access to this lesson.

How can I fix this? I tried doing lessons over but still it doesn't let me open this lab. All the previous readings and exercises are complete.

Broken exercise

This exercise does not work. Can someone please fix this?

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.