Using VexNet buttons as variables?

So I posted a similar thread here https://vexforum.com/t/new-to-easyc-looking-for-help/18045/1. Turns out that is only for official Vex help and not everyone can post answers there, opps :o. So I am also posting my question down here, so anyone can help. Pretty much I want to use the buttons on the VexNet control to act as variables. For example when X=1 (and X is a button) A prebuilt section of code activated, Else its rerouted back to the main driver controlled program. I have looked at the help section of the EasyC program, but I kind of got lost, mainly because I don’t know what specifically I am looking for. I think you can use a regular While and Else blocks to do this with the button assigned as the variable? Any help would be greatly appreciated.
William

if (X == 1) {
// your code to execute when X is 1
// here
} else {
// your code to execute when X is not 1
// here
}

Thanks paulctan, but then how do I tell the program that X is a button on the VexNet controller?

Under Joystick in the Function Blocks there should be a Get Joystick Digital, which you can use to retrieve a button from a joystick into a variable, and then test that variable.

Thank you very much paulctan, I’ll try programming the bot monday and see how it goes.
William