Skip to content

Instantly share code, notes, and snippets.

@TheMuellenator
Last active December 3, 2024 08:31
Show Gist options
  • Select an option

  • Save TheMuellenator/4bfc62a9f5226e10246fbb08e19bdea3 to your computer and use it in GitHub Desktop.

Select an option

Save TheMuellenator/4bfc62a9f5226e10246fbb08e19bdea3 to your computer and use it in GitHub Desktop.
iOS repl.it - Constants Challenge Solution
//Write your code here.
// Solution
let secondsInAnHour = 3600
// alternatively:
// let secondsInAnHour: Int = 3600
// Note, constants can only be set once and cannot be assigned a new value.
// The below does not work, because it is a constant and thus cannot be changed.
// secondsInAnHour = 1337
//Don't change the code below.
print(secondsInAnHour)
@rgsgroup2005

Copy link
Copy Markdown

LOL! Only here did I realize that I was wasting all this time adding minutes rather than seconds in the hour! 🤣🤦‍♂️

@brawler89

Copy link
Copy Markdown

My solution:

let secondsInAnHour: Int = 60*60

//Don't change the code below.
print(secondsInAnHour)

@Magdalenaspace

Copy link
Copy Markdown

func exercise() {

let secondsInAnHour = 60 * 60

print(secondsInAnHour)

}

@Turevha

Turevha commented Oct 5, 2022

Copy link
Copy Markdown

This was a straight forward answer, I even looked for some tricks too

@josileudo

Copy link
Copy Markdown

var hour = 1;
var min = 60
var sec = 60

let secondsInAnHour = hour * min * sec;

print(secondsInAnHour);

@Denaag

Denaag commented Jan 28, 2023

Copy link
Copy Markdown

let secondsInAnHour = 3600

print(secondsInAnHour)

@eltonbrayner

Copy link
Copy Markdown
let secondsInAnHour = 60 * 60

print(secondsInAnHour)

@NgoniKatsidziraDev

Copy link
Copy Markdown

func exercise() {
//Write your code here.
let secondsInAnHour: Int = 3600

//Don't change the code below.
print(secondsInAnHour)

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment