######## DM2 ######## basics 0: variables ######## further details see ######## https://developer.rhino3d.com/guides/rhinopython/ ######## command and functional test print( "Hello World!" ) print( "_diag: \"Hello World!\"\n\n" ) ######## variants to call print print( "Hello" + "World" + "!" ) ## concatenation print "Hello", "World", "!" ## default separator """ block comment do not execute these lines """ ######## types of variables ganzzahl = 3 ## integer variable, a number fliesskommazahl = 2.0 ## float variable, a number zeichenkette = "1" ## string variable print( zeichenkette + zeichenkette ) ## concat zeichenkette = 1 ## now redefine variable type print( zeichenkette + zeichenkette ) ## mathemetical addition print( "it's POSSIBLE to redefine variable types!\n" ); ######## basic math operators print( 3 + 2 ) ## sum print( 3 - 2 ) ## difference print( 3 * 2 ) ## product print( 3 / 2 ) ## quotient, integers and floats are treated as values print( 3 ** 2 ) ## exponentiation ######## calculate, concatenate, print print( ## command with left parenthesis "Adding: " ## string + ## concat str( ganzzahl ) ## include variable + ## concat " + " ## plus as character + ## concat str( fliesskommazahl ) ## include variable + ## concat " = " ## equals sign as character + ## concat str( ganzzahl + fliesskommazahl ) ## mathemetical addition ) ## right parenthesis, execute command (without semicolon) ######## calculate, concatenate, print, now in a single line print "Adding:", ganzzahl, "+", fliesskommazahl, "=", (ganzzahl+fliesskommazahl)