Learn with tiles › 28
Getting input
Take a value that the user types and use it.
1
Console: input line is a value tile that brings in one line typed by a person. You keep the value in a variable and use it.
When you press ▶ Run, the value shown at "Input ▸" at the top of the console screen goes in. (You cannot change the input here.) "Check" runs your tiles with several different inputs. So it must work for any name.
Put one line of input into the variable name.
To do Read a name from one line of input and say hello, like Hello, Lara!.
Loading tiles…
2
What you get from input is always text. If you get 3 and 4 and add them, they are joined and become 34.
To calculate, you must change them to numbers with the Text: to number tile. The first number is already changed. Change the second number too.
To do Read two numbers, one per line, and make their sum appear. For 3 and 4 it is 7.
Loading tiles…
3
You can use "if" with a number from input.
If the remainder after dividing by 2 is 0, the number is even.
Put ( ) == ( ) in the condition slot, and then put ( ) % ( ) in its left slot. You can put a tile inside a tile like this.
Make it tell whether the number from input is even or odd.
To do Make even appear if the number from input is even, and odd if it is odd.
Loading tiles…