Menu
CoddyTech

Recap - Validation Function

Part of the Fundamentals section of Coddy's GDScript journey. Lesson 56 of 92.

challenge icon

Challenge

Easy

Write 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

Practice on your own: Online GDScript compiler