KCL: No 'let' or 'const' required when declaring vars (#4063)
Previously variable declaration required a keyword, e.g. ```kcl let x = 4 const x = 4 var x = 4 ``` These were all valid, and did the exact same thing. As of this PR, they're all still valid, but the KCL formatter will change them all to just: ```kcl x = 4 ``` which is the new preferred way to declare a constant. But the formatter will remove the var/let/const keywords. Closes https://github.com/KittyCAD/modeling-app/issues/3985
This commit is contained in:
		@ -1,11 +1,11 @@
 | 
			
		||||
fn cube = (length, center) => {
 | 
			
		||||
  let l = length/2
 | 
			
		||||
  let x = center[0]
 | 
			
		||||
  let y = center[1]
 | 
			
		||||
  let p0 = [-l + x, -l + y]
 | 
			
		||||
  let p1 = [-l + x,  l + y]
 | 
			
		||||
  let p2 = [ l + x,  l + y]
 | 
			
		||||
  let p3 = [ l + x, -l + y]
 | 
			
		||||
  l = length/2
 | 
			
		||||
  x = center[0]
 | 
			
		||||
  y = center[1]
 | 
			
		||||
  p0 = [-l + x, -l + y]
 | 
			
		||||
  p1 = [-l + x,  l + y]
 | 
			
		||||
  p2 = [ l + x,  l + y]
 | 
			
		||||
  p3 = [ l + x, -l + y]
 | 
			
		||||
 | 
			
		||||
  return startSketchAt(p0)
 | 
			
		||||
  |> lineTo(p1, %)
 | 
			
		||||
@ -16,4 +16,4 @@ fn cube = (length, center) => {
 | 
			
		||||
  |> extrude(length, %)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const myCube = cube(40, [0,0])
 | 
			
		||||
myCube = cube(40, [0,0])
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user