Trouble with Text area


I need some help. I wanna have a user input on witch day it is. I use this line of code for that:

day = GUI.TextArea(new Rect(10, 10, 125, 25), day);

If the day is not Monday or Friday I wanna randomize between the examples(6 of them).

if(GUI.Button(new Rect(Screen.width / 2, Screen.height / 2, 125, 50), "Randomize")) {
	if(day != "Monday" || day != "Friday") {
		number = Random.Range(0, 5);

If it is Monday I only wanna randomize between example 1 and 2.

else if(day == "Monday") {
	number = Random.Range(0, 1);

If it is Friday I only wanna randomize between example 5 and 6.

else if(day == "Friday") {
	number = Random.Range(4, 5);

My problem is that whatever I write in the GUI.TextArea it randomizes everything. So for example if it is Friday it can choose from everything.

I hope someone more experienced then me can look at this :slight_smile:


The problem is the OR-operator. You said “If the day is not Monday or Friday…” but actually you want to say “if it’s not Monday and if it’s not Friday”:

if(day != "Monday" && day != "Friday")


You could also say “If the day is not (Monday or Friday)…” but the condition would be then:

if( !(day == "Monday" || day == "Friday"))