Solutions

Solutions#

Tools#

Solution to Exercise 1

            "label": "build & run",
            "command": "clang main.c; ./a.exe"

If you are curious why we don’t see 42 as exit code, let me explain:

  • each command returns an exit code when it exits

  • non-zero (>0) exit codes mean that something went wrong (including 42). Every error code encodes a different error. 42 does not have a particular meaning, I chose it randomly

  • we run two commands and the last command exits with an error, then the whole chain exits with the default error code 1.

You can change the returned value to a 0 to test my explanation.

Program control#

@startuml
start

if (is altitude > 100?) then (yes)
  #pink:thruster off;
elseif (is altitude > 0?) then (yes)
  #palegreen:thruster on;
else (no)
  #pink:thruster off;
endif

stop
@enduml