Anna and Else

--Originally published at Just A Turtle Coding.

There’s another part to the conditionals… the “else” statement.

In the last program, I only knew that if the condition wasn’t fulfilled, it wasn’t going to run… But now I know that there’s another way. If the condition isn’t fulfilled, then there’s something false… and what the “else” statement does, is it runs only if the condition isn’t fulfilled. 

I asked Owner some help with testing this theory. When I run the program: 

But when he runs it:

This happens because the answer is not yes. Note that the else statement can’t be used on its own, it has to be used after an if statement, otherwise the program doesn’t know which condition isn’t fulfilled.

Anna and Else

--Originally published at Just A Turtle Coding.

There’s another part to the conditionals… the “else” statement.

In the last program, I only knew that if the condition wasn’t fulfilled, it wasn’t going to run… But now I know that there’s another way. If the condition isn’t fulfilled, then there’s something false… and what the “else” statement does, is it runs only if the condition isn’t fulfilled. 

I asked Owner some help with testing this theory. When I run the program: 

But when he runs it:

This happens because the answer is not yes. Note that the else statement can’t be used on its own, it has to be used after an if statement, otherwise the program doesn’t know which condition isn’t fulfilled.

If i = boy

--Originally published at Just A Turtle Coding.

Owner was listening to a song while he was programming and explained to me how to use conditionals. He told me that a conditional inserts a condition (whoah, big surprise) that an object has to fulfill in order to continue down a programmed pathway. 

Here’s an example:

What the “if” statement does is that it conditions a part of the program to run only if a condition is fulfilled. 

If I input boy to the program, it shows what it was printed

If I input turtle to the program, it doesn’t work.

Here’s a video that helps turtles like me learn a little bit more about the topic. <3

If i = boy

--Originally published at Just A Turtle Coding.

Owner was listening to a song while he was programming and explained to me how to use conditionals. He told me that a conditional inserts a condition (whoah, big surprise) that an object has to fulfill in order to continue down a programmed pathway. 

Here’s an example:

What the “if” statement does is that it conditions a part of the program to run only if a condition is fulfilled. 

If I input boy to the program, it shows what it was printed

If I input turtle to the program, it doesn’t work.

Here’s a video that helps turtles like me learn a little bit more about the topic. <3