Identifying which Radiobutton is selected through code

Thanks Anthony. I didn´t quite understand how to set that up. I tried this but it doesnt work:

export function radiobuttongroup1_change(event) {
if ($w(‘#radiobuttongroup1’).selectedIndex = 3 {
$w(‘#box’).expand();

} 

else
$w(‘#box’).collapse();

}

Could you show me how to write the code please?

Will