Skip to content

Rewrite 2.4 Control Flow #1

@tomiam8

Description

@tomiam8

2.4 Control Flow covers if statements, but currently it's fragmented and dosen't have a clear thread explaining what's happen.

As mark suggested, we could explain it better by having a clear progression through complexity rather than just jumping around a bit like we do.

For example, pregressivly adding functionality to a mock account system that asks for input.
(Ask if they would like to delete their account. if so, set some variable to 0)
E.g.
Single line if:

if (userInput) someVarable = Null;

Then explain how you might want more functionality, i.e. execute multiple lines

if (userInput) {
    someVaraible = Null;
    System.out.println("Data deleted");
}

Then go on through:

  • Ask user to write some string like "Yes"
  • Explain numerical operators ( > / < / >= / etc.) IDK a good example for it though.
  • Do If / Else (Say print something if they don't want to delete)
  • Do If / Elif / Else (Say giving them three options)
  • Do switch statements

I would write this now... but I'm preparing for this friday's workshops and writing algorithims, so it's a remainder here for next year or something.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions