Exercise 2: Strings
Explore how to use the cat() function in R to print a string stored in a variable multiple times. This exercise helps you understand string handling and display methods in R programming. By completing it, you can confidently repeat and output strings using basic R functions.
We'll cover the following...
We'll cover the following...
Problem Statement
Print a string stored in a variable testVariable thrice by repeating the same string.
Use
cat()to display text on the screen.
Input
A testVariable containing the character string being used.
Output
Print the string three times.
Sample Input
learning is fun and easy
Output
learning is fun and easy learning is fun and easy learning is fun and easy
Test Yourself
Write your code in the given area. If you get stuck, you can look at the solution.