Here’s what it looks like:
// Example One function triangle(a,b): function sqroot(x): return Math.pow(x,.5) return sqroot( a*a + b*b )
// Example Two for var i=0; i<5; i++: var el = document.getElementById("el"+i) if count % 2 == 0: el.innerHTML = "Hello" else: el.innerHTML = "World"
// Pyscript function triangle(a,b): if a > 0 && b > 0: function sqroot(x): if x > 0: return Math.pow(x,.5) else: return 0 return sqroot( a*a + b*b ) else: return 0
How Do I Get It?
<script src="pyscript.js"/>to your
- Put your pyscript code in a
Pyscript is really just a proof of concept. It has a set of unit tests, and as you can see not all functionality is completed yet. Anonymous inline functions do not work, there is no robust handling of indentation, and a number of features (like switch) do not work. But, the whole thing is open source so you can get involved.