What is Selection?

Selection is one of the three logical structures in programming that allows you to control the flow of the program. You do this by giving a condition and if it's met, do something. If it is not met, do something else. This is just a simple example (it could get more complicated than this).
Real world example: If it is your birthday, play a birthday song. Else, play classical music.
notion image
Using the previous example, 1 would be “is today your birthday?”, 2 would be “play a birthday song” and 4 would be “play classical music.”

Next Section

Notes on the Condition
Copyright © 2021 Code 4 Tomorrow. All rights reserved. If you would like to use content from any of our courses, you must obtain our explicit written permission and provide credit. Please contact classes@code4tomorrow.org for inquiries.