#Dead Code Error

1 messages · Page 1 of 1 (latest)

fallow duneBOT
#

<@&987246399047479336> please have a look, thanks.

fallow duneBOT
#

While you are waiting for getting help, here are some tips to improve your experience:

Code is much easier to read if posted with syntax highlighting and proper formatting.

If nobody is calling back, that usually means that your question was not well asked and hence nobody feels confident enough answering. Try to use your time to elaborate, provide details, context, more code, examples and maybe some screenshots. With enough info, someone knows the answer for sure.

Don't forget to close your thread using the command </help-thread close:1027500463647621170> when your question has been answered, thanks.

pliant vigil
#

When can the if be true ?

sweet glade
#

no true for it

#

no statement

pliant vigil
sweet glade
#

I'm confused with your question

#

theres no if true statement for the variables inside

#

if thats what you mean

pliant vigil
#

you have an if

#

my question is

#

when will if condition will ever be false ?

sweet glade
#

Ah right

#

If the input is not in the hashmaps

pliant vigil
#

are you sure about that

sweet glade
#

Yes

pliant vigil
#

what does null + null do ?

sweet glade
#

When I type in a incorrect input, i get

#

GRMAN : Null

#

FRENCH: Null

pliant vigil
#

yes

#

so

#

what does null + null do ?

sweet glade
#

if(result + result2 != null + null)

#

this?

pliant vigil
#

what does null + null do ?

#

answer my question please

sweet glade
#

nothing

#

it does nothing?

pliant vigil
#

wdym

#

how can it do nothing ?

sweet glade
#

what does null + null mean

pliant vigil
#

let's say you write null + null in your program

sweet glade
#

yes

#

I get error

pliant vigil
#

what does it give ?

#

yes

#

it errors

sweet glade
#

the operator +

#

when i use &&

#

it strill doesnt wokr

pliant vigil
#

no

#

it's about null + null

#

do you agree that you can't do null + null ?

sweet glade
#

The Operator + is undefined for the argument type(s) Null, null

pliant vigil
#

yes

#

if(result + result2 != null) {

}
this is your code, and you have a condition where you add two values together

sweet glade
#

right

#

to check

pliant vigil
#

how can result + result2 be null ?

sweet glade
#

ok i removed reuslt 2

#

wow

pliant vigil
#

please answer my questions

sweet glade
#

result + result2 is null if input is incorrect

pliant vigil
#

incorrect = ?

#

result == null and result2 == null ?

sweet glade
#
        englishToFrench.put("hello", "salut");
        englishToFrench.put("you", "vous");
        englishToFrench.put("beer", "bière");
        englishToFrench.put("table", "tableau");
        englishToFrench.put("chair", "chaise");
        englishToFrench.put("i", "je");
        englishToFrench.put("the", "la/le");
        englishToFrench.put("cannot", "ne peux pas");
        englishToFrench.put("monitor", "surveiller");
    }

    private void fillEnglishToGerman() {
        englishToGerman.put("hello", "hallo");
        englishToGerman.put("saussage", "wurst");
        englishToGerman.put("beer", "bier");
        englishToGerman.put("table", "tisch");
        englishToGerman.put("chair", "stuhl");
        englishToGerman.put("i", "ich");
        englishToGerman.put("you", "du/sie");
        englishToGerman.put("the", "der/die/das");
        englishToGerman.put("work", "arbeit");
fallow duneBOT
sweet glade
#

if it is not one of those

pliant vigil
sweet glade
#

no

#

it isnt

#

== null

#

anywhere

pliant vigil
#

wdym

#

how can result + result2 be null ?

#

what result and result must be equal to so this condition is true ?

sweet glade
#

it must be equal to a string that is in those hashmaps

#

and its input

pliant vigil
#

that's not my question

#

if(result + result2 != null) {

}

#

what result and result2 must be equal to in order for this to be false ?

sweet glade
#

null

pliant vigil
#

so result = null

#

and result2 = null

#

right ?

sweet glade
#

ok

#

yeah

pliant vigil
#

so in this case

#

if(null + null != null) {

}

#

you are doing this

#

do you see the problem ?

sweet glade
#

mhm

#

but

#

then

#

nvm

#

but

#

it work

#

for only 1 null

pliant vigil
#

yes

sweet glade
#

2 nulls

#

make a non null

pliant vigil
#

no

#

2 nulls cause an error

#

as we saw earlier

sweet glade
#

and to get around this eror

#

error

#

we

#

how we do we do tihs

pliant vigil
#

result == null && result2 == null

sweet glade
#

if(result != null && result2 != null)

#

thankls

sweet glade
#

!solved

teal scroll