# SwiftUI Data Part 2: #16 Variables...receiving error

**URL:** <https://forums.kodeco.com/t/swiftui-data-part-2-16-variables-receiving-error/202348>\
**Category:** Swift\
**Created:** [February 15, 2024, 5:53am UTC](https://forums.kodeco.com/t/swiftui-data-part-2-16-variables-receiving-error/202348 "2024-02-15T05:53:40Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![dinzo](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/dinzo/32/109772_2.png) [@dinzo](https://forums.kodeco.com/u/dinzo)\
**Post date:** [February 15, 2024, 5:53am UTC](https://forums.kodeco.com/t/swiftui-data-part-2-16-variables-receiving-error/202348/1 "2024-02-15T05:53:40Z")

</div>

Hello all,

I am receiving this error “Variable ‘roundedValue’ was never used; consider replacing with ‘\_’ or removing it” but feel that I have followed the instructor and can’t understand where this is coming from. Who can help to trouble shoot?

struct ContentView: View {  
@State private var alertisVisible: Bool = false  
@State private var sliderValue: Double = 50.0

var body: some View {  
VStack {  
Text(“🎯🎯🎯\nPUT THE BULLSEYE AS CLOSE AS YOU CAN TO”)  
.bold()  
.multilineTextAlignment(.center)  
.lineSpacing(4.0)  
.font(.footnote)  
.kerning(2.0)  
Text(“89”)  
.kerning(-1.0)  
.font(.largeTitle)  
.fontWeight(.black)  
HStack {  
Text(“1”)  
.bold()  
Slider(value: $sliderValue, in:1.0…100.0)  
Text(“100”)  
.bold()  
}  
Button(“HIT ME”) {  
alertisVisible = true  
}  
.alert(  
“Hello there!”,  
isPresented: $alertisVisible,  
actions: {  
Button(“Awesome”) {  
print(“Alert Closed”)  
}  
},  
message: {  
var roundedValue: Int = Int(sliderValue)  
Text(“The slider’s value is (sliderValue), and rounded value is /(roundedValue).”)  
}  
)  
}  
}  
}

struct ContentView\_Previews: PreviewProvider {  
static var previews: some View {  
ContentView()  
}  
}

---

<div class="post-metadata">

**Author:** ![dinzo](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/dinzo/32/109772_2.png) [@dinzo](https://forums.kodeco.com/u/dinzo)\
**Post date:** [February 15, 2024, 5:54am UTC](https://forums.kodeco.com/t/swiftui-data-part-2-16-variables-receiving-error/202348/2 "2024-02-15T05:54:17Z")

</div>

error occurs at line 45

---

<div class="post-metadata">

**Author:** ![dinzo](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/dinzo/32/109772_2.png) [@dinzo](https://forums.kodeco.com/u/dinzo)\
**Post date:** [February 15, 2024, 5:58am UTC](https://forums.kodeco.com/t/swiftui-data-part-2-16-variables-receiving-error/202348/3 "2024-02-15T05:58:58Z")

</div>

I figured it out but it’s not clear how to deleted my question.

---

<div class="post-metadata">

**Author:** ![szymczyk](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/szymczyk/32/105896_2.png) [@szymczyk](https://forums.kodeco.com/u/szymczyk)\
**Post date:** [February 16, 2024, 9:24pm UTC](https://forums.kodeco.com/t/swiftui-data-part-2-16-variables-receiving-error/202348/4 "2024-02-16T21:24:20Z")

</div>

Instead of deleting your question, post the solution. By posting the solution, you can help other people who have a similar problem in the future.

---

<div class="post-metadata">

**Author:** ![system](https://s3.amazonaws.com/cdn.raywenderlich.com/community/forum-assets/noun-game-ghost-878668.png) [@system](https://forums.kodeco.com/u/system)\
**Post date:** [July 30, 2024, 9:53pm UTC](https://forums.kodeco.com/t/swiftui-data-part-2-16-variables-receiving-error/202348/5 "2024-07-30T21:53:53Z")

</div>

Closed on July 30, 2024, 9:53pm UTC

This topic was automatically closed after 166 days. New replies are no longer allowed.
