Question: I would like to know if there is an R function that allows to prevent some lines of the code to be executed.

For instance, if this function exist and is called prevent, I could put on my code at line number 10 :

prevent(line12, line17)

and those line wouldn't be executed.

The application for me would pe to prevent some line which are in a loop to be executed, if a condition that I would test **before** going in the loop is not satisfyed.

It's a matter of optimization : I could test the condition inside the loop but I would rather test it before, since I already know wheter the condition is true or not.

Here is an example :

```
         Condition=T

         if (Condition){
           Dont execute line 17
         }

         for (i in 1:n){
line 17    Print("I'm happy")
         }

```

Answer: 
You could simply use an `if` statement:

```
condition <- T

for (i in 1:3) {
  if (condition) {
    cat("Execute this \n")
  }
}

```
you could just add an "#" before the code line you don't want to execute

```
# 2+2
2+2

```

You can do it for multiple lines with cmd+shift+c in studio in mac, there should be an Linux or windows equivalent