!
operator that is causing you confusion?text
field or property of the object at index 0 of the choices
array (or object presenting an array like interface), that is in the reportString
object. With the exclamation mark, you are telling the compiler that you are guaranteeing that your reportString
reference will not be null.What exactly do you not understand? Is it the!
operator that is causing you confusion?
choices[0].text
GetFirstChoiceTextFromResponseString(Thing responseString)
then that's a clue - you wouldn't be getting the first one if you returned choices[1]. But then you'd probably ask me "why are we getting the first one?" - I have no idea; because that's what the business logic demands from the process at that particular point in time. Why does it demand it? I don't knowI didn't understand is why we should access the first element of the string or array.choices[0].text;
choices
element of the JSON array needs to be pulled out, and why the text
property of that object in the first element. The current documentation seems to indicate that there is no text
field anymore.