# Fatal Error... Please help

**URL:** <https://forums.kodeco.com/t/fatal-error-please-help/18576>\
**Category:** iOS Apprentice\
**Created:** [August 17, 2016, 10:55am UTC](https://forums.kodeco.com/t/fatal-error-please-help/18576 "2016-08-17T10:55:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![beijkido](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/beijkido/32/57458_2.png) [@beijkido](https://forums.kodeco.com/u/beijkido)\
**Post date:** [August 17, 2016, 10:55am UTC](https://forums.kodeco.com/t/fatal-error-please-help/18576/1 "2016-08-17T10:55:22Z")

</div>

Just started on the iOS Apprentice (still on the first one, Bull’s Eye, page 65). I did everything that I was told to do, but I keep getting this message. Thread 1 exc\_bad\_instruction (code=exc\_i386\_invop subcode=0x0).

I get the error at the line; (slider.value) = Float(currentValue)

Can someone please explain what I did wrong and how I can solve the error?

Here is my code.

import UIKit

class ViewController: UIViewController {

```
var currentValue: Int = 50
var targetValue: Int = 0

@IBOutlet weak var slider: UISlider!

override func viewDidLoad() {
    super.viewDidLoad()
    startNewRound()
}

override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of any resources that can be recreated.
}

func startNewRound() {
    
    targetValue = 1 + Int(arc4random_uniform(100))
    currentValue = 50
    (slider.value) = Float(currentValue)
}

@IBAction func showAlert() {
    let message = "The value of the slider is: \(currentValue)"
        
        + "\nThe target value is: \(targetValue)"
    let alert = UIAlertController(title: "Hello, World",
                                  message: message, preferredStyle: .Alert)
    let action = UIAlertAction(title: "OK", style: .Default, handler: nil)
    alert.addAction(action)
    presentViewController(alert, animated: true, completion: nil)
    startNewRound()

```

}  
@IBAction func sliderMoved(slider: UISlider) {  
currentValue = lroundf(slider.value)

```
}

```

}

---

<div class="post-metadata">

**Author:** ![marciokoko](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/marciokoko/32/32922_2.png) [@marciokoko](https://forums.kodeco.com/u/marciokoko)\
**Post date:** [August 17, 2016, 4:41pm UTC](https://forums.kodeco.com/t/fatal-error-please-help/18576/2 "2016-08-17T16:41:09Z")

</div>

Odd. Try removing the parentheses from the left side, those are not needed.

Try cleaning your project and rebuilding.
