#Given the Day number, print the Day name in lower case corresponding to it by using the help of swit

1 messages · Page 1 of 1 (latest)

peak shard
#

i have solved it but getting an error

versed kiteBOT
#

This post has been reserved for your question.

Hey @peak shard! Please use /close or the Close Post button above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

peak shard
#

did i wrote anything wrong?

pallid plank
#

that's not an error. That's just intelliJ letting you know that your current switch can be replaced with an enhanced switch which would look like this:

switch(n) {
  case 1 -> System.out.println("Monday");
  ...
peak shard
pallid plank
#

do you get an error when running the program ?

peak shard
pallid plank
#

do you want to share the error with me or keep it to yourself ?

peak shard
pallid plank
#

sure just need information about the other problem

peak shard
#

question- Write a program using only while loops to print all the even numbers from 1 to n

#

it says false😅

mossy shale
#

move i++ out of the if block

peak shard
mossy shale
#

line 11 will never be executed

#

since i is 1

peak shard
#

so what i have to do to remove this error?

mossy shale
#

move i++ out of the if block

peak shard
#

yea int i=0

mossy shale
#

well try

peak shard
#

nvm not working but showing green tick

peak shard
#

like this ?

mossy shale
#

when does the body of if block executed?

peak shard
#

yea got it

#

now i understand

#

thanks :}

versed kiteBOT
# peak shard thanks :}

If you are finished with your post, please close it.
If you are not, please ignore this message.
Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.

peak shard
#

have a nice day :}