Q. How is the switch() function different from if-else in R?

  • (A) switch() is used for multiple conditions, if-else for two conditions
  • (B) switch() can only handle numeric values, if-else can handle any type
  • (C) if-else can only handle numeric values, switch() can handle any type
  • (D) Both switch() and if-else are used interchangeably
πŸ’¬ Discuss
βœ… Correct Answer: (A) switch() is used for multiple conditions, if-else for two conditions

You must be Logged in to update hint/solution

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
116
Total Visits
πŸ“½οΈ
2 y ago
Published
πŸŽ–οΈ
Mr. Dubey
Publisher
πŸ“ˆ
94%
Success Rate