C# If Else vs Variables
I'm trying to figure out which approach would be better to take, an if
else statement or using variables. I'm working on making a program that
enters data into a database created within the program, and can retrieve
that data. Some of the retrieved data will have specific data associated
with it. An example of what I'm trying to do. Let's say in my Form, I have
a field titled "Size". This field can have a 11 different numerical
values. I have another field on my for titled "Theo Area", this value has
to correlate to the size. So, if I enter "5" in the size field, I need
"Theo Area" to populate with ".31". That's because 5 = .31. Let's say I
enter a "4" in size instead, I need the theo area field to populate ".20",
because 4 = .20.
Which would be a better choice, the if else or a variable, and how exactly
should I write this?
No comments:
Post a Comment