A Question About Whitespaces


I don’t understand, where do we use whitespaces? What is the purpose of it? What would happen if I didn’t use it?


where many languages are using curly brackets:

// javascript
if (true){
console.log("hello world")

to determine for example what is nested in the if clause, python uses indent:

# python
if True:
    print "hello world"

print "i am outside the if clause"

we can use indent in JS as well, its recommended:

// javascript
if (true){
    console.log("hello world")

but its only for the sake of readability, the curly brackets determine that console.log is nested in the if clause

by using indent to determine nesting, you force and enforce readability through indent.


Thank you. :slight_smile:


Hi there,

I am just on the part about white space and even after reading your description I don’t understand its purpose. Why do you use curly brackets? what does nested in clause mean?

Thank you


well, if you read the comments in the code samples, the curly brackets are used in a language called javascript. I just demonstrate it to indicate that many other languages uses curly brackets, where as python uses indent (whitespaces)

well, if consist of a condition and the code within the if block which executes if condition is true. This i name the if clause.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.