Menu
Coddy logo textTech

Recap - Validation Function

Part of the Fundamentals section of Coddy's C# journey — lesson 53 of 69.

challenge icon

Challenge

Easy

Write a method named is_valid that gets two strings arguments, username and password.

The method will return True if the username and password are valid in the system, otherwise False.

Our system contains only two valid usernames - "admin" and "user".

The valid password for username "user" is "qweasd".

For username "admin" any password is valid!

Try it yourself

using System;

public class Program {
    public static bool is_valid(string username, string password) {
        // Write your code below
        
    }
    
    public static void Main(string[] args) {
        string user = Console.ReadLine();
        string pass = Console.ReadLine();
        bool res = is_valid(user, pass);
        Console.WriteLine(res);
    }
}

All lessons in Fundamentals