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

iOS

BizzBuzz 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

Can you post your code and the corresponding errors?

on 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.

So it's working now?

no the %% problem i mentioned before is still giving me trouble

Did 1 % not work you say?

if numBox % 3 == 0 

it didn't

It might have to do with the numBox, not the %%. were is numBox in your code?

i introduce the numBox to the code a line before the if numBox % 3 == line

@IBAction func numBox() { if numBox %% 3 == 0 {

I tried to google it but I couldn't find anything, can you?