Conditionals
This section explains how programs can be made to take decisions on their own by a process known as "branching".
Last updated
This section explains how programs can be made to take decisions on their own by a process known as "branching".
Last updated
Programs power thousands of many different tools in use today, from traffic lights to smartphones and the Internet, from social media applications like TikTok to life-saving equipment like MRIs and laser-assisted surgical equipments.
These complex applications need to be to make decisions on their own based on their understanding of certain conditions. For example,
a traffic light controller has 3 colours ββred, amber and green ββ and needs to decide which colour to display, based on the current traffic conditions
an iPhone needs to decide which application to start, based on which button was tapped on the screen
the TikTok application needs to decide which video to play, based on the video currently visible to the current user
In this section, we will write a simple traffic controller program.