Welcome back.
So now let's look at how we can display answers as well.
Because currently we are only displaying the question one question so far.
But let's also display the answers for that one question okay.
Therefore what we can do is we can use a for loop here.
So for int I I questions length.
Well actually questions dot answers or question dot answers dot length is what we need I plus plus.
So what is going on here.
Well the thing is I'm not interested in the amount of questions that I'm going to have.
So not the array of questions, but I'm in this particular case only displaying one question including
its answers.
So what I'm interested in is the amount of answers that I have.
Because if you look at it, a string answers here.
This is an array of strings that will contain the answers.
So I'm interested in however many answers we have for that particular question.
So what I'm saying is go through all of the answers and display them now step by step with this for
loop.
So what I'm going to display here is Console.WriteLine.
And I'm going to say dot and then question dot answers at I.
And I need to finish the quotations here.
So I'm just using this dot.
This is just a visual cue.
Like it's basically I'm saying 1.2..
But I'm not adding this other stuff yet.
We are going to make it look a little nicer later on.
Actually we can get rid of it for now.
So I'm just going to display the answers.
And by this I mean all answers that we have inside of any given question.
So we're defining here that we have four answers.
But this can be different for every single question if you want to.
So here we're going through all of them okay.
So let's actually run this and see if it will display all of our answers.
And there we are.
It says what is the capital of Germany.
It says Paris Berlin London Madrid.
Okay.
So now let's actually add what I just said.
Let's make this whole answer look a little nicer.
And you know how I'm going to do that.
I'm going to do that with the console class features.
So there is this thing called foreground color which you can set to a given color.
So there is this enum.
We're going to see what enums are later on.
But basically it's just a collection of colors that we can use.
And it's just going to allow us to use the color for example cyan okay.
So you can see what you can do is you can change the text color.
So the foreground color is the text color of your console.
And you can change that to whatever color is inside of this console color.
For example I'm going to use cyan as I said, right.
So you can use dots and select the color that you want.
There are plenty of colors magenta, cyan, all the good stuff.
So I'm going to say use the color cyan.
And then use console dot write.
So we're going to use write this time and not write line.
What right does is it just writes the text without creating a new line.
So without going into the next line inside of our console.
And then I'm going to use console dot write again.
And this time I'm going to use I plus one.
And I'm going to use console dot reset color after that.
So what is going on here.
Well let's see it.
And then you well let's run it and you will see it.
So you see here one Paris two Berlin.
And that's what I meant earlier with dot m t space.
So I'm going to say dot empty space.
Question answer.
Now let's run it again and you will see that it looks like this now.
So this right here this one, this line in 24.
What it did is it added this empty area here.
And that's why we're using write instead of write line.
Because write line always adds a line break right.
Or adds a line break before.
And then it goes into the text.
Then I'm saying use I plus 1YI plus one.
Well, because we start counting with one as humans, right?
We don't start counting at zero.
So here you see I'm using instead of zero because int I starts with zero I'm just saying zero plus one.
So just add a one to every single iteration so that it's more human like.
So where we start at one instead of zero.
If I don't have that, let me get rid of it and rerun it.
Just so you see it, it will start at zero.
It will say zero Paris one, Berlin two London.
You can obviously do that, but it's just not nice.
Okay.
So it doesn't look great.
So that's why I'm adding the plus one here.
Then I'm resetting the color.
So this resets the foreground star one let's say text color.
And this one here changes the text color.
Here we add the number and then we add.
A dot empty space.
And that's when we are displaying the answer.
And we do that for every single answer now.
So yeah, that's pretty much our display question method.
Now obviously while we're at it, we can also make the question look nicer.
So what we can do is we can use console dot foreground color.
And I'm going to use yellow this time.
So here yellow and I'm going to use console dot write line.
And I'm not going to type this in.
But it's really just a bunch of a bunch of lines and stuff.
So you see here this is how I'm going to make it look like.
So these are individual characters right.
And I'm just adding a bunch of characters here and then a bunch of empty spaces.
So you can just download the project.
And there you can get these lines from I would recommend you do that instead of typing in manually,
but you can obviously also try to find the right UTF number or code for this particular sign and then
make it look nicer.
So here I'm setting the color to yellow.
So this whole border plus this question text will be using yellow color.
And then I'm going to reset the color and then write the question out okay.
So let's run this.
And you can see that it says in yellow question.
Then it displays the question okay.
So that's it for this video.
See you in the next one.