# Revision history [back]

### Redeclare loop_rate depending on boolean

Given this example, in which I want to decide via if which loop_rate to use when spinning

      if(my_bool)  ros::Rate loop_rate(100); //Hz
else ros::Rate loop_rate(10);


The compiler complains about rate not declared, as it is out of scope. But I need the if to decide which rate to get.