NESTED INDENTATION:Bansal Sir
4 posters
Page 1 of 1
NESTED INDENTATION:Bansal Sir
Write a code to check whether the compiler supports nested indenntation??
ballu- Posts : 58
Join date : 2009-02-01
Re: NESTED INDENTATION:Bansal Sir
example of a python script...
import sys
'''This module returns a list of primes till an integer n'''
def get_primes(n):
......primes=[]
......sieve = range(2,n+1)
___
___while len(sieve):
_________a = sieve.pop(0)
_________sieve = filter(lambda i : (i%a!=0), sieve)
_________primes.append(a)
___print primes
if __name__=='__main__' :
_____if len(sys.argv) == 2:
_________n = int(sys.argv[1])
_____else :
_________print "Using default value of 32"
_________n = 32
_____get_primes(n)
import sys
'''This module returns a list of primes till an integer n'''
def get_primes(n):
......primes=[]
......sieve = range(2,n+1)
___
___while len(sieve):
_________a = sieve.pop(0)
_________sieve = filter(lambda i : (i%a!=0), sieve)
_________primes.append(a)
___print primes
if __name__=='__main__' :
_____if len(sys.argv) == 2:
_________n = int(sys.argv[1])
_____else :
_________print "Using default value of 32"
_________n = 32
_____get_primes(n)
Beagle- Posts : 40
Join date : 2009-01-30
Re: NESTED INDENTATION:Bansal Sir
do u mean to say as an alternative to {} in c/c++??
then try this code
well it will definitely fail for c++,but i think u are getting the idea.
then try this code
- Code:
#include<iostream>
using namespace std;
int main()
{
int i = 1;
if(false)
i=0;//dummy, since we know it wont run anyway
i--;
cout<<"indentation: boolean value = "<<i;
cin>>i;
}
well it will definitely fail for c++,but i think u are getting the idea.
Re: NESTED INDENTATION:Bansal Sir
kya bol rahe ho bhaiya sab upar se ja raha hai nestes indentataion ka maaatlab kya hai??
mnnit.rahul- Posts : 51
Join date : 2009-02-01
@everyone
abe it means
does your compiler recognisez this type of syntax
/*
/*
*/
*/
does your compiler recognisez this type of syntax
/*
/*
*/
*/
ballu- Posts : 58
Join date : 2009-02-01
Similar topics
» C:Nested Function Declarations Not allowed:Pulkit Sir
» ASCII VALUE : Bansal Sir
» PRODUCTS: Bansal Sir
» Guess Output - Bansal Sir
» FIND ELEMENTS: Bansal Sir
» ASCII VALUE : Bansal Sir
» PRODUCTS: Bansal Sir
» Guess Output - Bansal Sir
» FIND ELEMENTS: Bansal Sir
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|