Recap - Validation Function
Part of the Fundamentals section of Coddy's GDScript journey. Lesson 56 of 92.
Challenge
EasyWrite a function named is_valid with two String parameters, username and password. It returns true when the login is valid, and false otherwise.
The system has only two users:
"admin": any password is valid."user": the only valid password is"qweasd".
Every other username is invalid. For example, is_valid("user", "qweasd") returns true and is_valid("user", "1234") returns false.
The tests call is_valid() themselves. Do not call it, and do not print anything.
Try it yourself
func is_valid(username: String, password: String):
# Write code here
pass
All lessons in Fundamentals
4Operators Part 1
Arithmetic OperatorsInteger DivisionModulo OperatorArithmetic ShortcutsRecap - Simple MathComparison Operators10Functions
Declare a FunctionArgumentsReturnReturn TypesRecap - Sigma FunctionRecap - Validation FunctionDefault Values5Operators Part 2
Logical Operators Part 1Logical Operators Part 2Recap - Simple LogicLogical Operators Part 3Ternary OperatorPractice on your own: Online GDScript compiler