Printing types

Exercise Type: Implementation

Instructions

We have a variable var that includes a single value, such as:

var <- 6

Part 1.

Write a bit of code that prints out to the console the content of var, and its type in this format:

The variable 'var' contains the value '<value>', and it is of type '<type>'.

Part 2.

Test your code with:

var <- "code"

The result you should be

The variable 'var' contains the value 'code', and it is of type 'character'.

Part 3.

Test your code with different types assigned to ‘var’, e.g.:

var <- 1.2e4
var <- TRUE