Giter Site home page Giter Site logo

ios-loops-exit-ticket's Introduction

Loops Exit Ticket

Instructions for lab submission

  1. Fork the assignment repo
  2. Clone your Fork to your machine
  3. Complete the lab
  4. Push your changes to your Fork
  5. Submit a Pull Request back to the assignment repo
  6. Paste a link to of your Fork on Canvas and submit

Question 1

What will the code below print?

var myNum = 8

for number in 4..<8{
if number == 7 {
break
} else {
myNum += number
}
}

print(myNum)

23


Question 2

Which of the following loops will print out all the numbers between 1 and 100, inclusive? Select all that apply.

a)

for i in 1..<100 {
print(i)
}

B)

for j in 1...100 {
print(j)
}

C)

for k in 1..<1000 where k < 101 {
print(k)
}

D)

for l in 1...100 where _ < 101 {
print(l)
}

A, B, and C


Question 3

How many times will the code below print "Nesting!" ?

for _ in 1...10{
for _ in 1...10{
print("Nesting!")
}
}

100 because it runs 10 times within each loop.


Question 4

Which of the loops below will run forever? Select all that apply.

a)

var q = 0

while q%2 != 1 {
print("Hello Problem Two!")
q += 2
}

b)

var r = 0

while r < 10 {
print("Hi there!")
r += 11
}

c)

var s = 0

while 3 != 3 {
print("Howdy!")
s += 1
}

d)

var t = 0

while t == t{
print("Ahoy-hoy!")
t += 1
}

A and D will loop forever


ios-loops-exit-ticket's People

Contributors

davidlawrencer avatar tijanae avatar

Watchers

 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.