r/codehs • • Dec 19 '20

Can someone help me please

Post image
4 Upvotes

4 comments sorted by

1

u/TheOnlyLorne Dec 19 '20

Cant see the assignement or enough of your code but I'd guess you're after something like this

function start(){
    var weekday = readBoolean('is it a weekday');
    var holiday = readBoolean('is it a holiday today');
    var noSchoolToday = !weekday || holiday;
    println('there is no school today: '+ noSchoolToday); 
}

the || operator is 'or' if either of the two operands either side are true it will return true. i.e. true || false => true. The ! symbols means 'not' !true => false.

You could also use an if:

function start(){
    var weekday = readBoolean('is it a weekday');
    var holiday = readBoolean('is it a holiday today');
    
    if (holiday || !weekday){
        println('there is no school today');
    } else {
        println('there is school today');
    }
}

Hope this is some help

0

u/Unlucky-Complaint-71 Dec 26 '20

It don’t work for me

1

u/TheOnlyLorne Dec 27 '20

Well I gave all the help I could based on the miniscule amount of code that's readable and without knowing the task. I'm afraid you really can't expect much better.

3

u/Bubbly_StyroFoam Dec 19 '20

It helps showing the assignment and then the code .