76.2k views
0 votes
How many spaces are proper for indentation of nested elements?

A) 2 spaces
B) 4 spaces
C) 8 spaces
D) No spaces, use tabs

1 Answer

5 votes

Final answer:

The proper number of spaces for indentation of nested elements is usually 4 spaces in computer programming. This convention helps to visually distinguish nested elements and improves code readability.

Step-by-step explanation:

The proper number of spaces for indentation of nested elements in computer programming is usually 4 spaces. It is a common convention to use 4 spaces for indentation in languages like Python, JavaScript, and Java. This helps to visually distinguish nested elements and improves code readability.

For example, in Python:

if condition:
statement1
if nested_condition:
statement2

In this code snippet, the nested if statement is indented with 4 spaces.

User Morten Fjeldstad
by
9.0k points