Snap and JavaScript

snap needs to add stuff like the ability to turn your code to pure javascript
and vis versa JavaScript to snap

You might want to look into codificiation. Just opennthe example codification project (file > open > examples > codification )

this doesnt really explain anything, how does this work?

That's an example code that you can codify to a language. Place it in the script variable, then scrill to the bottom to see the codification scripts. There's literally a comment at the top that says "drag any example script into this ring:"

it still looks confusing

This script runs FizzBuzz on numbers 1 to 100. For each number from 1 to 100, if the number is divisible by 3, it says Fizz, if the number is divisible by 5, it says Buzz, if it is divisible by both, it says FizzBuzz, and if it is divisible by neither, it just says the number. I'd recommend checking out the Wikipedia article for more info.

The Snap! script uses the modulo (mod) operator to check if one number is evenly divisible by another. For example, if you have 15 mod 2, the operator would return the remainder of 15 divided by 2, which is 1.


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.