Skip to content

Commit 7201350

Browse files
Fix issue with ternary operator
1 parent 5e08c10 commit 7201350

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

csharp/list-quickstart/Program.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,15 @@ void WorkWithString()
3939

4040
var index = names.IndexOf("Felipe");
4141

42-
index == -1 ? Console.WriteLine($"When an item is not found, IndexOf returns {index}")
43-
: Console.WriteLine($"The name {names[index]} is at index {index}");
42+
Console.WriteLine(index == -1
43+
? $"When an item is not found, IndexOf returns {index}"
44+
: $"The name {names[index]} is at index {index}");
4445

4546
index = names.IndexOf("Not Found");
4647

47-
index == -1 ? Console.WriteLine($"When an item is not found, IndexOf returns {index}")
48-
: Console.WriteLine($"The name {names[index]} is at index {index}");
48+
Console.WriteLine(index == -1
49+
? $"When an item is not found, IndexOf returns {index}"
50+
: $"The name {names[index]} is at index {index}");
4951

5052
names.Sort();
5153
foreach (var name in names)

0 commit comments

Comments
 (0)