0

Ребят кто подскажет как можно соединить функции Console.ReadLine и if-else(или же switch)?

23rd Mar 2020, 10:26 AM
Keyfi
Keyfi - avatar
4 odpowiedzi
+ 3
But, What you mean by COMBINING if else and Console.ReadLine()? Maybe this: using System; public class Program { public static void Main() { Console.WriteLine("Enter Password"); string password = Console.ReadLine(); if (password == "abcdef") { Console.WriteLine("Correct Password"); }else { Console.WriteLine("Incorrect Password"); } } }
23rd Mar 2020, 11:03 AM
Sarthak
Sarthak - avatar
+ 1
Ok thank you I'm understand Console.ReadLine+if-else= bad idea Maybe i can combine Console.ReadLine and switch?
23rd Mar 2020, 11:07 AM
Keyfi
Keyfi - avatar
+ 1
Keyfi Its similar technique, just different syntax. Try to code that yourself. If any problem, we'll try to help.
23rd Mar 2020, 11:09 AM
Sarthak
Sarthak - avatar
+ 1
Ok thanks
23rd Mar 2020, 11:11 AM
Keyfi
Keyfi - avatar