Creating functions | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Creating functions

I have a code but I not sure how to make it work.

7th Mar 2020, 11:07 PM
Zo Nelson
Zo Nelson - avatar
4 Answers
+ 3
Yeah, please show us your code and tell us what exactly doesn't work, otherwise it's hardly possible to help you.
7th Mar 2020, 11:23 PM
HonFu
HonFu - avatar
+ 3
Hello Zo Nelson You can save your code in code playground. Then post the link to the code here. Just click on the plus sign and choose insert code. Change hot today to my code bits and choose your code you want to add.
7th Mar 2020, 11:23 PM
Denise Roßberg
Denise Roßberg - avatar
+ 3
Instead of an if statement you only need to use the not operator. lightBoxOn = !lightBoxOn; Means if lightBoxOn = true it changes to false (!true = false). If it is false it changes to true (!false = true).
8th Mar 2020, 12:05 AM
Denise Roßberg
Denise Roßberg - avatar
0
function lightboxFlipSwitch() { // if variable switchDirection is equal to "on", // set lightboxOn to true // otherwise // set lightboxOn to false } Here it is, I am trying to make an LED lightbox with a switch turn off and on with the code.
7th Mar 2020, 11:55 PM
Zo Nelson
Zo Nelson - avatar