Deep into Ring

This is a fancy way to full-fill your list with even numbers. And of course you can fill it with whatever you want. but this is an automated way in order to fasten your way of development. you can find that it’s done in few lines.

There it’s

# Declaration of an empty list.
myList = [] 

# this list size, it also could be taken as input.
listSize = 10 

# function call by passing the list and maximum size.
generateEven(myList, listSize) 

# to view the list
see myList 

func generateEven inp_List,maxLen #function body.
	
        # For-loop starts from 0 index to maxLen with step 2 bec we need even numbers.
	for i=0 to maxLen step 2 
		#to add in inp_List the value of i.
		Add(inp_List,i)
	next

and of course the output should be:

0
2
4
6
8
10

PS: and of course you can save your time by implementing function like above. That file could have your defined functions for automation. That will save your time and re-usability will be involved.

Peace.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s