- Joined
- Jun 14, 2021
- Messages
- 6
- Reaction score
- 0
I wish to add a Boolean value as a control which determines if a different error message is displayed within my case statements, knowing I should declare the variable as:
Inside my statement:
Although the purpose of changing Boolean value from true-false is that I wish to display the message 'Already in session.' if the first case has previously been ran and I do not know how to code this.
Code:
boolean bool = true;
Inside my statement:
Code:
switch (data) {
case "HELLO":
sendln(String.format("HELLO %s; pleased to meet you!", getSocket().getRemoteSocketAddress().toString()));
//set bool to false
break;
case "BYE":
sendln("Brew what?");
break;
default:
sendln("ERR Sorry did not understand. Say BYE if you wish to exit.");
break;
}
Although the purpose of changing Boolean value from true-false is that I wish to display the message 'Already in session.' if the first case has previously been ran and I do not know how to code this.