✅ Selection using spectre.console
``cs
using Spectre.Console;
using System.Threading.Channels;
void choiceMenu()
{
var choice = AnsiConsole.Prompt(
new SelectionPrompt<string>()
.AddChoices(new[] {
"1| Reboot Audio Systems"
, "2| Reboot Camera Systems"
, "3| Reboot Ventilation System"
, "4| Reboot All Systems"
}));
}
Console.Beep(1500, 800);
if ( = );
Console.Beep(1200, 800);
Console.Write("0");
cs
if (choiceMenu = 1 ;
Console.beep(1000, 800);
```
only gives me a method group error.
I dont know how to go about this, please help

15 Replies
$paste
If your code is too long, you can post to https://paste.mod.gg/, save, and copy the link into chat for others to see your shared code!
in the future, please do not include a picture of yourself (i assume?). it is not helpful to the helping process
not me, thought it was a nice addition
it is not
thank you this is much more organised
hello sir
I have 1 more follow up question
I wanna make this selection thing a method so I can pull it up faster,
but when I do it, the choice in the if statement doesnt work anymore because its now indented into the method
@killa.rei strongly suggest you learn how to actually write functions. the code you have shared so far indicate that you do not.

$scopes
thing a
is available in scope A
and scope B
thing b
is available only in scope B
choice
variable exists within the choiceMenu()
method and only there
You probably want to return the choice from the method
And use thatThere is no method body in that screenshot
Ah, right, the semicolon
so how would i call it in an if statement?
acc lemme search up
lol! my bad