Explain how to control line endings in a print()
This commit is contained in:
		
							parent
							
								
									770a1a21b6
								
							
						
					
					
						commit
						47803c2f54
					
				| 
						 | 
					@ -3,6 +3,12 @@
 | 
				
			||||||
# We show output in the terminal to a user with the "print" function
 | 
					# We show output in the terminal to a user with the "print" function
 | 
				
			||||||
print("Hello world!")
 | 
					print("Hello world!")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# By default, print() will put a new line at the end of ever print.
 | 
				
			||||||
 | 
					# If you want to stay on the same line (so you can add to it later)
 | 
				
			||||||
 | 
					# you must change the end character to be blank
 | 
				
			||||||
 | 
					print("This is on a line.", end='')
 | 
				
			||||||
 | 
					print(" This is on the same line!")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# This is a variable. A variable holds information like a string (letters and such),
 | 
					# This is a variable. A variable holds information like a string (letters and such),
 | 
				
			||||||
# integers (whole numbers), arrays and objects (discussed later)
 | 
					# integers (whole numbers), arrays and objects (discussed later)
 | 
				
			||||||
# Our first "string"
 | 
					# Our first "string"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user