ifstatement, which allows us to do things conditionally in our programs, rather than doing them on every run.
app/controllers/programs_controller.rband let's start a new program where it says:
https://ruby-intro-[YOUR CLOUD 9 USERNAME].c9users.io/first. That is where the output of this other program is being displayed. Modify
@your_outputto confirm this.
1 < 2to
2 < 1and refresh the page.
end, so just type it before you type anything else and forget it.
endwill only be executed if the expression next to the
false, then the code inside the
ifstatement will simply be ignored.
elsefallback branch is executed; but you don't have to have one if you don't want one.
ifstatement, you can have as many lines of code as you want -- and you can even have whole other multi-branch if statements, if that's what you need.
||. These allow you to combine comparisons; try these out in
&&is stricter than
||; both comparisons have to be true in order for the whole statement to be true when combined with
&&; either one being true is sufficient for