return statement - return NAN - (Arduino Uno Programming for Beginners)

Поделиться
HTML-код
  • Опубликовано: 2 окт 2024
  • return statement - return NAN - (Arduino Uno Programming for Beginners)
    In this video I show you what a return statement is and how we can make use of a special value called NAN.

Комментарии • 2

  • @Volker-Dirr
    @Volker-Dirr 5 месяцев назад

    I prefer to write the error message already in the function (So before "return NAN"), because...
    a) ... by that you only need to write it once. (Since functions are often used more than only once).
    b) ... you might do an other calculation that results into NAN and then your error message is "wrong", since the reason is not because of dividing by 0. Maybe the first argument was already NAN or ...

    • @playduino
      @playduino  5 месяцев назад

      I agree, thank you for sharing :)