Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Taylor Buffa
622 PointsBizzBuzz Generator in Swift
I was trying to turn the FizzBuzz Generator, made in the Swift basics course, into an app but Swift keeps telling me that theres mistakes all over the place. Help!!
import UIKit
class ViewController: UIViewController {
@IBOutlet weak var bizzBuzzGen: UILabel!
@IBOutlet weak var buzzGen: UILabel!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
@IBAction func numBox() {
if numBox %% 3 == 0 {
bizzBuzzGen.text == ("Bizz")
} else if numBox % 4 == 0 {
buzzGen.text == ("Buzz")
} else {
bizzBuzzGen.text == (numBox)
}
}
}
5 Answers
Caleb Kleveter
Treehouse Moderator 37,862 PointsCan you post your code and the corresponding errors?
Caleb Kleveter
Treehouse Moderator 37,862 PointsSo it's working now?
Taylor Buffa
622 Pointsno the %% problem i mentioned before is still giving me trouble
Caleb Kleveter
Treehouse Moderator 37,862 PointsDid 1 % not work you say?
if numBox % 3 == 0
Taylor Buffa
622 Pointsit didn't
Caleb Kleveter
Treehouse Moderator 37,862 PointsIt might have to do with the numBox, not the %%. were is numBox in your code?
Taylor Buffa
622 Pointsi introduce the numBox to the code a line before the if numBox % 3 == line
@IBAction func numBox() { if numBox %% 3 == 0 {
Caleb Kleveter
Treehouse Moderator 37,862 PointsI tried to google it but I couldn't find anything, can you?
Taylor Buffa
622 PointsTaylor Buffa
622 Pointson the "if numBox %% 3 == 0 {" line it says use of unresolved identifier '%%'. I tried using one % and switched it to a division sign because that would work too.
I somehow fixed the rest of the errors.