Tasker: Switch Data Network for Different Apps
You do not need to use "if-else" in this.

Instruction for Tasker


Create a new Profile with Context as Applications
Choose your apps in which you prefer to have 3G
Create a new Task.
Add action: Mobile Data = 3G
Press back see Profile tab again.
Long Press Task (Mobile Data 2G/3G). A pop-up will come.
Select Add Exit Task
Under it, add the following actions:  


Wait 30 seconds  
Mobile Data : 2G