Can anyone explain to me what the following syntax mean?
ViewData [“greeting”] = (hour <12 ? “Godd morning” : “Good afternoon”);
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This ternary operator call (equivalent for if then else structure) will provide the string Godd morning if the value of
houris less than 12 and otherwise Good afternoon.That result is put into ViewData[“greeting”] which can later on be used in your view to display the message.