August 2017
Beginner
566 pages
12h 34m
English
Now I will show you how to use this new feature. As in the previous chapter, I will enter the following, keeping things very simple:
double height = 65; //7. Creates and assigns a variable
In the next stage, let's say that you want to print a variable. To do so, enter the following command. Note that I have placed a dollar sign ($) on the right-hand side. In the context of string interpolation, the dollar sign has nothing to do with money. It is a symbol that is required to allow you to embed variable names directly into strings:
sampLabel.Text=$
Next, type double quotes and enter the following:
sampLabel.Text=$"Height is "
Unlike before when we had to type a plus sign (+) and the name of the variable, we can now just ...
Read now
Unlock full access