Skip to content

Latest commit

 

History

History
30 lines (21 loc) · 662 Bytes

Practical-1.1.md

File metadata and controls

30 lines (21 loc) · 662 Bytes
  1. Write a Fibonacci numbers generator using recursion.

  2. Write code to find the Factorial of a given Number.

  3. Write Swift Program to Check Whether a given Number is Palindrome or Not

  4. Write subscript for below given struct

struct WeekDays {
  var days = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday"]
}
  1. What is the output of this piece of code? Explain the difference in behavior of color and weekday variables.
var color = "blue" 
var weekday = "Monday" 
let closure = { [color] in 
    print("My favorite color is \(color)") 
    print("Today is \(weekday)") 
} 

color = "green" 
weekday = "Tuesday" 

closure()