Block code challenge

Hi friends i have a challenge this code block. i trying to compare a text in the text box and the value in a list variable. "if" code works fine when the variable is empty have the error massage, first "if else" code also work fine when no text is entered in both userName_textbox and password_textbox text boxes then i have error massage
however the second "if else" code don't work if i enter the text i stored in the variable userName in userName_texbox text box the log_error_alert so up it massage "User name or password incorrect." and that is not what i want i want the code to go the next if else.


if userName is a list (I'm supposing a list of userNames...) you must check if userName_textBox is in the list so, use "is in list?" block

i want compare if userName_texbox text is not equal to userName variable's content by the userName variable is going to contain only one item

Dear @Opk,
i guess that the first comparison is intended to verify if the global variable userName is an empty list (as @Ramon also asks), but you cannot compare this variable with the method "create empty list".
You'd rather compare with "is list empty list ?" block instead.
Or please give us further details.
something like:

1 Like

And for the else if statement where you want to check if the userName_textbox is in that list:

(Be careful, case sensitive)

1 Like

Dear @uskiara,
ask said in my first post where i compare if the variable is empty that is working fine the challenge is the second if else code line where i want to compare if userName_texbox's text IS NOT EQUAL TO userName variable's content then the error massage should display however even if i enter the text i stored in userName variable in the userName_textbox i still have the error massage on the screen

Ok, so it seems different from what I've understood at the beginning.
The text box is the input from the user that has to be compared against the userName variable.
in this case you can use a simple text comparison, like:
Please be aware that "trim" avoids to have heading and trailing spaces that can foolish the comparison, then the "upcase" avoids that upper and lowercase can generate a (unwanted) difference.
Don' care about the fact that TextBox is a global variable in my snapshot, it's just for explaining purposes.

Ok thanks
@uskiara I will try your option