This post will give you the idea in certain ways to use if else, and condition in knockout JS in Magento 2
If else conditions in KO template
<!-- ko if: myData -->
..if statement goes here
<!-- /ko -->
<!-- ko if: !(myData) -->
..else statement goes here
<!-- /ko -->
If else conditions in KO template with && operator
<!-- ko if: X && Y -->
//your code
<!-- /ko -->
<!-- ko if: X && !Y -->
//your code
<!-- /ko -->
<!-- ko if: !X && !Y -->
//your code
<!-- /ko -->