Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
summer_2019:glowscript_tips [2019/08/13 00:22]
wellerd
summer_2019:glowscript_tips [2019/08/13 00:27] (current)
wellerd
Line 23: Line 23:
   * **Printing values and text** - The ''​print()''​ command will output any value called from within the parentheses. You can print variables and attributes from your code as a way of checking what numbers the simulation has calculated. The following code creates a conical object named ''​IceCreamCone'',​ and the ''​print(IceCreamCone.size.x)''​ command prints the x-component of the object'​s size attribute. If you want to print text, it must be transformed into a "​string"​ of letters by using quotation marks within the ''​print()''​ command.   * **Printing values and text** - The ''​print()''​ command will output any value called from within the parentheses. You can print variables and attributes from your code as a way of checking what numbers the simulation has calculated. The following code creates a conical object named ''​IceCreamCone'',​ and the ''​print(IceCreamCone.size.x)''​ command prints the x-component of the object'​s size attribute. If you want to print text, it must be transformed into a "​string"​ of letters by using quotation marks within the ''​print()''​ command.
 <​code>​ <​code>​
-IceCreamCone=cone(pos=vec(10,20,0), axis=vec(5,0,0), size=vec(12,3,3)) +IceCreamCone=cone(pos=vec(0,0,0), axis=vec(0,-5,0), size=vec(3,1,1)) 
-print(IceCreamCone.size.x)+print("Ice cream cone length:", ​IceCreamCone.size.x)
 print("​Two scoops of butter pecan please!"​) print("​Two scoops of butter pecan please!"​)
 </​code>​ </​code>​
  • summer_2019/glowscript_tips.1565655765.txt.gz
  • Last modified: 2019/08/13 00:22
  • by wellerd