Lektion 2
This commit is contained in:
21
Lektion 2/Logische_Operatoren/Enthalten/Enthalten.pde
Normal file
21
Lektion 2/Logische_Operatoren/Enthalten/Enthalten.pde
Normal file
@@ -0,0 +1,21 @@
|
||||
float a = 10;
|
||||
float b = 5;
|
||||
float x = 6.3;
|
||||
|
||||
void setup() {
|
||||
|
||||
// Check whether a is bigger b or the other way around
|
||||
if ( a < b) {
|
||||
if (a < x && x < b) {
|
||||
println("x innerhalb");
|
||||
} else {
|
||||
println("x außerhalb");
|
||||
}
|
||||
} else if ( a > b) {
|
||||
if (b < x && x < a) {
|
||||
println("x innerhalb");
|
||||
} else {
|
||||
println("x außerhalb");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user