1. ## Approach

I wonder how a statement can be assignd/ replaced with one word.
For the example below. How is it possible to assign:
if (Value1 < Value2)..... then ...... statement = true; ?

Then when I refer to the word &#180;statement&#180; then I actually refer to
if (Value1 < Value2).
What approch could be used for this ?

Code:
```int Value1 = 100;
int Value2 = 200;

if (Value1 < Value2) ...```

2. Sound easy.

(Value1 < Value2) will evaluate to true or false. Bools and Integers can hold true or false.

bool result ;
result = Value1 < Value2

if (result) ...

3. I am trying this code but somthing is wrong. I cant figure out what it could be.

Code:
```int Value1 = 100;
int Value2 = 200;
int Value3 = 0;

bool result;

result = Value1 < Value2

if (result)
{
Value3 = 10;
}```

4. Originally Posted by Coding
I am trying this code but somthing is wrong. I cant figure out what it could be.
Missing semicolon.

5. Originally Posted by Coding
I am trying this code but somthing is wrong. I cant figure it out what it could be.

Code:
```int Value1 = 100;
int Value2 = 200;
int Value3 = 0;

bool result;

result = Value1 < Value2;

if (result)
{
Value3 = 10;
}```
Listen to the errors your compiler reports.

6. This doesn&#180;t work either. My whole code look like this. It seems strange. It looks right.

Code:
```#include "stdafx.h"
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <vector>

int Value1 = 100;
int Value2 = 200;
int Value3 = 0;

bool result;

result = Value1 < Value2;

if (result)
{
Value3 = 10;
}```

My compiler says:

see declaration of 'result'
syntax error : 'if'
syntax error : missing ';' before '{'
'result' : redefinition; different basic types
'{' : missing function header (old-style formal list?)

7. You can't run code outside of a function. Put all that in main.

8. Originally Posted by Coding
My compiler says:

syntax error : missing ';' before '{'
See, it told you right there. Read the messages.

9. Yes ofcourse. I forgot the int main()... Not the missin ; before {

Thanks

10. Another way to do this is to have a function return the result of the expression, like this:

if ( result() ) ... ;

bool result() { return Value1 < Value ; }

11. If value three would be something else otherwise, you could also use the ternary operator, along with all the other logical alternatives.

Code:
```int main ( )
{
int foo, bar, quz;
foo = 100;
bar = 200;

quz = foo < bar ? 10 : -10;
}```
But you know, C++ programming isn't necessarily about how much you can cram into an expression, but what is the most expressive or easiest to understand way that works. What you initially wrote would have been fine.