Learning to code
Scenario 4 - Conditional Statements
Operational Goals
- Ability to apply conditional statements in code
Introduction to the Topic
Conditional statements (in short, Conditions) allow for the execution of certain parts of the code (sequence of instructions) only if a specific situation occurs, i.e., the condition is met. Conditions in programming languages take the form of additional code instructions such as 'if, then', which should be included in the designed algorithm. For the conditional instruction, you need to specify the condition that this instruction will check. If the condition is met, a certain sequence of code will be executed, which should be defined within the scope of the condition, limited by the beginning and end of the scope.
Task
Command: Arrange the code from blocks, set the appropriate step values, and lead Kodi to the finish. Remember to apply the conditional instruction block with the "Collect" action for the field where a gold coin may be located.
Course I, Conditional Instructions "Execute if" - Level 0 - Single conditional instruction
Course I, Conditional Instructions "Execute if" - Level 0 - Board solution
Task
Command: Arrange the code from blocks, set the appropriate step values, and lead Kodi to the finish. To activate the "Teleport" field, the Elf on the board must first press the button. Apply parallel events and arrange the code to be executed by each character. Also remember to apply directional actions and conditional instruction blocks for fields with a question mark.
Note: In this task, we program concurrently - you need to arrange two sequences of commands that will be executed in parallel.
Course III, Conditional Instruction - Level 5 - Exercise in concurrent movement of two characters and conditional instructions
Course III, Conditional Instruction - Level 5 - Board solution
Manage Consents
Control which external services can process your data.
Essential Required
These features are essential for the proper functioning of the website and cannot be disabled.
Anonymous Analytics Required
Required for collecting aggregated statistics that help us understand how users interact with our site. Data is fully anonymous, contains no personal information, and we do not use cookies.
Extended Analytics
Allows analyzing traffic sources (where you came from), marketing campaign parameters (UTM), and navigation paths across subdomains. We use a cookie (7 days) to preserve this data.
External Media
Allows loading content from external services like YouTube or Vimeo.