Closed frankcollins3 closed 1 year ago
just seeing: 👍 javascript: !== 👎 C# !==
👍 C#: !=
[10:54am]
👍 this works perfectly:
in the below photo:
dotnet run
-->
"User" entered into the input and the while block never executes because it's one of the three options.
An argument checking for empty string is also there so the initial value doesn't validate while block statement.
dotnet run
to restart console -->
👎 'friend' (! "Admin" || "Manager" || "User"]
👎 'wow'
(! "Admin" || "Manager" || "User"]
👎 'sure' (! "Admin" || "Manager" || "User"]
👍 👍 👍 "User" -> 1 of the three while-block-invalidating string-values entered into the input and now while loop skip
[10:57am]
possible improvements: I feel like there's a way to do this without having 2 Console.ReadLine() statements though. [11:03am]
also, I made a wrongful assumption and chatGPT corrected it:
Microsoft did not get rid of goto
in C# but it is just as advised against as it apparently is/was in C++
perhaps not an improvement but a fun quirk to add, I feel there's a way to use goto to restart the console but know from C that goto can restart but not re-enter inputs, not sure if C# would be same
[11:05am]
wow goto works as expected [11:17am]
attempting to do: gather input recursively, requesting user enters either: ['admin', 'manager', 'user'] into the input.
error:
proposed approach: clean ? retry ? [10:50am]
first approach can be minimum viability based rather: only 'admin' string will invalidate the while block for now. get the expression working with 1 condition before extending to alternative arguments that invalidate the while block [10:52am]