jsseng / arduino_robot

1 stars 2 forks source link

when statements and when not #42

Closed ooee123 closed 9 years ago

ooee123 commented 9 years ago

I made a fairly neat discovery that our language supports without planning for it.

when get button {
  ...code...
}

when not get button {
   ... otherwise do this...
}

You can insert a not between the when and the expression. It's useful for assigning a "default behavior" to do when a button is not toggled. like set the LED to be off.

Language wise, it would be a good idea to combine them by joining them by an "else" Will explore.