Tuesday, September 19, 2023
Envato Elements
HomeCodingDart Programming Embed A Variable In A String.

Dart Programming Embed A Variable In A String.

Problem Statement

You are given two variables, name and age, which store a person’s name and age respectively. You have to embed the name and age in a larger string and print the final string.

Input

The input is the variable’s name and age.
Name and Age have already been declared for you.

Output

The output will be the final string in which you will embed your name and age.

Example

Sample Input

“Ben”, 18

Sample Output

“Ben is 18 years old.”

Program

void main() {
	var name, age;
  name = "Ben";
  age = 18;
  String output = "$name is $age years old";
  {
    print(output);
  }
}

OUTPUT:

Ben is 18 years old
RELATED ARTICLES
- Advertisment - Domains + Hosting + Security

Most Popular

Recent Comments