#elif

This preprocessor directive is a contraction of #else and #if, and avoids multiple #endif's at the end. Here is an example without #elif:

	#if rce1
	...
	#else
		#if rce2
		...
		#else
			#if rce3
			...
			#else
			...
			#endif
		#endif
	#endif

The same example above using #elif would be:

	#if rce1
	...
	#elif rce2
	...
	#elif rce3
	...
	#else
	...
	#endif

which is shorter and clearer.


© 1991-2008 Prem Sobel. All Rights Reserved.