Using C# Ternary Operator -
probably simple syntax problem. attempt @ console program reads length of string received via user input. if length greater 144, user notified string length long, otherwise string inputted output console.
string input = console.readline(); (input.length > 144) ? console.writeline("the message long"); : console.writeline(input); console.readline();
getting syntax errors in present state on line 2. missing parentheses?
try:
console.writeline((input.length > 144) ? "the message long" : input);
you need use return value of operator, or receive compile-time error only assignment, call, increment, decrement, , new object expressions can used statement
.
none of these other answers compile, i'm not sure getting at.
Comments
Post a Comment