update the if sample
add switch sample