Front sm

tsunamininja5

Branch: Tomas

If-Boolean Logic
In this example, the aIsBigger() method should return true if the int parameter a is larger than b by 2 or more. This code uses an if with && ("and") to return true if the condition is met. Alternately, the run falls through to the return-false at the bottom. This is a pretty simple way to do it.

public boolean aIsBigger(int a, int b) {
if (a > b && (a - b) >= 2) {
return true;
}

return false;
}

Alternately it can be done with an if/else structure like this:

public boolean aIsBigger(int a, int b) {
if (a > b && (a - b) >= 2) {
return true;
} else {
return false;
}
}

And in fact, since the boolean test is true when we want to return true, and false when we want to return false, it can be written as a one-liner like this:

public boolean aIsBigger(int a, int b) {
return (a > b && (a - b) >= 2);
}

 

 

 

 

 

. . . what?

 

I don't care if this is "easy", I'm stupid and I have no idea how to use booleans and heck I don't even know how to code in the first place

 

Why did I take this class

  • Posted at:

Please tell us why you'd like to report this post

- Samurai -

- Jaguar -

Est. January 2014

 

So if you jump, kid, don't be scared to fall

We'll be kings and queens in this dream

All for one, one for all

You can light up the dark

There's a fire in your heart

Burning brighter than ever before

 

 

Front sm

daintysprinkles16

Branch: Ekaterina

XD Oh my word. You poor soul.

  • Posted at:

Please tell us why you'd like to report this post

ALLY IRENE

Drama! Parts I've played:

Katherine (Newsies)

Wendy (Peter Pan)

Fantine (Les Mis)

Maria (Sound of Music)

Front sm

butterflyamber887

Branch: Lucian

Whaaa? I- I- I gotta... olives! Yeah! 

  • Posted at:

Please tell us why you'd like to report this post

Bracha

 

Life's tough. I try to be tougher.

 

Broken legs but I chase perfection

These walls are my blank expression

My mind is a house I'm trapped in

And it's lonely inside this mansion

                                                         

Front sm

amberdolphin1210

Branch: Lucian

I thought a Boolean was something like, you search for (example:) Miraculous Ladybug, but you choose, "Miraculous OR Ladybug" or "Miraculous AND Ladybug". Man, now you've confused me. Just when I thought I understood Booleans for my Tech Assignment.

  • Posted at:

Please tell us why you'd like to report this post

Amber.

 

Miraculer

Whovian!

I'm from the 39 clues website!

Forum Twins: Fiona and Jaiden

I'm A Jehovah's Witness.

Check out my RPs! the 39 clues, Vespers RP. Children of Bigfoot RP, Limited Spots

leave a message at the beep, unless it's bad news BEEP

Front sm

creativescarlet16

Branch: Lucian

I'm also stupid and taking geometry, which is supposedly the norm for 10th graders, but I'm in level 2 and all my friend are taking algebra 2/trig/pre-calc/calc levels 1 or honor or ap or something, so yea

 

I don't know what this is. Boolean sounds like some sort of fantasy creature that likes sweets.

  • Posted at:

Please tell us why you'd like to report this post

 R E M E M B E R T H E L O S T 

 

*yEETS AWAY*

 

"I thought mascara was a fish"-Galaxian

"None shall harm my sculpted calves"- Ishmael

"Brussels sprouts are just delicious earth meatballs"-Becky

 

 

 

 

 

 

 

 

Front sm

dogyellow583

Branch: Ekaterina

what

  • Posted at:

Please tell us why you'd like to report this post

       Christy ~ I'm sorry I'm a monster, I'm sorry you're an angel; I'm sorry you're the one who                   

                           had to teach me to be careful with love"

Front sm

midnightlightning285

Branch: Ekaterina

Searched up on google: how do booleans work

 

Boolean Operators. Boolean Operators are used to connect and define the relationship between your search terms. When searching electronic databases, you can use Boolean operators to either narrow or broaden your record sets. The three Boolean operators are AND, OR and NOT.

 

 I gave up after this.

  • Posted at:

Please tell us why you'd like to report this post

I'm not one to wait respond ASAP Call me

 

One of these choices. 

Redstonian Emboar (prefered) 

Midnight Thunder,

Demon of the Earth,

Theory Theorist, 

Golden Foxy,  

MEGAMEWTWOZ. 

 

in all further messages

 

RP NAMES:

Dimensior 

 David

Dave/Lightnin(g) Bedrockian

Front sm

spyunicorn1

aka FieryLucian3

Branch: Lucian

Is this Java? Basically a boolean is a ... thing (I forgot the word sorry modmins xD) I guess that can be either true or false in computer programming.

 

In this example

public boolean aIsBigger(int a, int b) { //We declared integer variables a and b which I guess you'd have to initialize (put values into)
if (a > b && (a - b) >= 2) { //it's asking if a is larger than b and if (a-b) is larger than or equal to 2
return true; //if both of the above conditions are met, the program will return 'true' which I guess affects something else in the program
}

return false; // if the above conditions are not met, the program will return 'false' which will affect the program as well
}

 

The second example is the same thing, except with an else statement

 

The third example is showing a way to condense all the code we just went through.

 

Hope this helps :)

  • Posted at:

Please tell us why you'd like to report this post

ChuCahill & MBer siπce '12

professional craftinator.

#NeverAgain | #SayNoToRacism | #MeToo

"In 2022, who was best man at Dan and Phil's wedding?"

"A terrifying hybrid of of Chris and PJ."

"Correct!"

#It's A Chain Reaction of Compassion

Front sm

tsunamininja5

Branch: Tomas

Thanks, Chu. :D

  • Posted at:

Please tell us why you'd like to report this post

- Samurai -

- Jaguar -

Est. January 2014

 

So if you jump, kid, don't be scared to fall

We'll be kings and queens in this dream

All for one, one for all

You can light up the dark

There's a fire in your heart

Burning brighter than ever before

 

 

Front sm

sapphiredragon5553

Branch: Lucian

Am I the only one who doesn't understand

  • Posted at:

Please tell us why you'd like to report this post

Hi, it's Katie:) I'm Lucian and a bit Janus but I'm nice:) I'm home-schooled and on a lot and I would love to chat with anyone! And I'm trying to get my first a five hundred stars, thanks if you make that happen!:)

Front sm

amberdolphin1210

Branch: Lucian

Don't worry Katie. This is not the Boolean I'm familiar with.

  • Posted at:

Please tell us why you'd like to report this post

Amber.

 

Miraculer

Whovian!

I'm from the 39 clues website!

Forum Twins: Fiona and Jaiden

I'm A Jehovah's Witness.

Check out my RPs! the 39 clues, Vespers RP. Children of Bigfoot RP, Limited Spots

leave a message at the beep, unless it's bad news BEEP

Front sm

tsunamininja5

Branch: Tomas

@Amber

It is, booleans are booleans

 

This is using them to code something

  • Posted at:

Please tell us why you'd like to report this post

- Samurai -

- Jaguar -

Est. January 2014

 

So if you jump, kid, don't be scared to fall

We'll be kings and queens in this dream

All for one, one for all

You can light up the dark

There's a fire in your heart

Burning brighter than ever before

 

 

Front sm

amberdolphin1210

Branch: Lucian

Now I'm just blooming confused.

  • Posted at:

Please tell us why you'd like to report this post

Amber.

 

Miraculer

Whovian!

I'm from the 39 clues website!

Forum Twins: Fiona and Jaiden

I'm A Jehovah's Witness.

Check out my RPs! the 39 clues, Vespers RP. Children of Bigfoot RP, Limited Spots

leave a message at the beep, unless it's bad news BEEP