Discourse post - markdown formatting a block of code to improve readability

By formatting a block to show indentation helps in better code readability, and easier to read and faster response from the community if you ever post a question here.

Using triple back ticks to format a block of code

Transform the text from

x = 67
for i in range(100):
if i < x:
print(i)
else:
print(x+i)

by using ``` triple back ticks to format a block of code to show indent

```
x = 67
for i in range(100):
if i < x:
print(i)
else:
print(x+i)
```

, and transform the code into the following:

x = 67
for i in range(100):
   if i < x:
       print(i)
   else:
       print(x+i)
Using python3 color coded

Transform the text from

x = 67
for i in range(100):
if i < x:
print(i)
else:
print(x+i)

by using ``` triple back ticks to format a block of code to show indent

```python3
x = 67
for i in range(100):
if i < x:
print(i)
else:
print(x+i)
```

, and transform the code into the following:

x = 67
for i in range(100):
   if i < x:
       print(i)
   else:
       print(x+i)
Markdown format for SQL

Transform the text from

SELECT
id
name
address
FROM
employee

by using ``` triple back ticks to format a block of code to show indent

```
SELECT
id
name
address
FROM
employee
```

, and transform the code into the following:

SELECT 
     id
     name
     address
FROM 
     employee 

Additional tip:
Add url to the mission will have a faster reply since we don’t need to search for the specific mission.

Type the following in your post to include mission:

[mission name](mission url)
4 Likes