Just starting out? Need help? Post your questions and find answers here.
			
		
		
			
				
																			
								Polo 							 
						Addict 			
		Posts:  2422  		Joined:  Tue May 06, 2003 5:07 pm 		
		
											Location:  UK 
							
						
		 
		
						
						
													
							
						
									
						Post 
					 
								by Polo   »  Wed Nov 09, 2005 2:23 pm 
			
			
			
			
			Don't know if it's supposed to be normal or not, but this code :
Gives "Not a valid decimal number" 
 Everytime I use a variable name starting with a number it says that ! How come I can't do that ??
 
			
			
									
									
						 
		 
				
		
		 
	 
				
			
		
		
			
				
																			
								benny 							 
						Enthusiast 			
		Posts:  465  		Joined:  Fri Apr 25, 2003 7:44 pm 		
		
																Location:  end of www 
							
							
				Contact: 
				
			 
				
		 
		
						
						
						 
			 
													
							
						
									
						Post 
					 
								by benny   »  Wed Nov 09, 2005 2:36 pm 
			
			
			
			
			@Polo: 
 
I guess it's just the definition of the purebasic parser. In the help it says that 
variables shouldn't start with a number. 
 
So, when the parser parses a new word which starts with a numeric value it 
assumes that it is a decimal number and not  a variable. 
 
That's all ...
			
			
									
									regards, 
benny! 
- 
pe0ple ar3 str4nge!!!
						 
		 
				
		
		 
	 
	
						
		
		
			
				
																			
								Chris 							 
						User 			
		Posts:  60  		Joined:  Wed Jun 11, 2003 4:54 pm 		
		
											Location:  Somewhere... But i can see you! 
							
						
		 
		
						
						
						 
			 
													
							
						
									
						Post 
					 
								by Chris   »  Wed Nov 09, 2005 2:37 pm 
			
			
			
			
			A variable can't begin by a number.
			
			
									
									My english is bad !!!... It's normal, i'm french  
My english is not really the English.
It's the FrogLish (Froggy's English) 
 
						 
		 
				
		
		 
	 
	
						
		
		
			
				
																			
								Polo 							 
						Addict 			
		Posts:  2422  		Joined:  Tue May 06, 2003 5:07 pm 		
		
											Location:  UK 
							
						
		 
		
						
						
						 
			 
													
							
						
									
						Post 
					 
								by Polo   »  Wed Nov 09, 2005 3:11 pm 
			
			
			
			
			All right, I still find this weird, anyway...
			
			
									
									
						 
		 
				
		
		 
	 
	
						
		
		
			
				
																			
								Trond 							 
						Always Here 			
		Posts:  7446  		Joined:  Mon Sep 22, 2003 6:45 pm 		
		
											Location:  Norway 
							
						
		 
		
						
						
						 
			 
													
							
						
									
						Post 
					 
								by Trond   »  Wed Nov 09, 2005 4:05 pm 
			
			
			
			
			Chris wrote: A variable can't begin by a number.
So then it should give the error "not a valid variable" and not "not a valid decimal number", shouldn't it?
 
			
			
									
									
						 
		 
				
		
		 
	 
	
						
		
		
			
				
																			
								Polo 							 
						Addict 			
		Posts:  2422  		Joined:  Tue May 06, 2003 5:07 pm 		
		
											Location:  UK 
							
						
		 
		
						
						
						 
			 
													
							
						
									
						Post 
					 
								by Polo   »  Wed Nov 09, 2005 4:27 pm 
			
			
			
			
			Trond wrote: Chris wrote: A variable can't begin by a number.
So then it should give the error "not a valid variable" and not "not a valid decimal number", shouldn't it?
But then, if the compiler could catch the error, it could also make the variable working, so that's why I posted it here, I think it's possible 
 
			
			
									
									
						 
		 
				
		
		 
	 
	
						
		
		
			
				
																			
								Trond 							 
						Always Here 			
		Posts:  7446  		Joined:  Mon Sep 22, 2003 6:45 pm 		
		
											Location:  Norway 
							
						
		 
		
						
						
						 
			 
													
							
						
									
						Post 
					 
								by Trond   »  Wed Nov 09, 2005 5:23 pm 
			
			
			
			
			Polo wrote: Trond wrote: Chris wrote: A variable can't begin by a number.
So then it should give the error "not a valid variable" and not "not a valid decimal number", shouldn't it?
But then, if the compiler could catch the error, it could also make the variable working, so that's why I posted it here, I think it's possible 
Whether variables can start with a number or not is not a question of possible/not possible, it's a question of language design.
 
			
			
									
									
						 
		 
				
		
		 
	 
	
						
		
		
			
				
																			
								Pupil 							 
						Enthusiast 			
		Posts:  715  		Joined:  Fri Apr 25, 2003 3:56 pm 		
		
						
						
		 
		
						
						
						 
			 
													
							
						
									
						Post 
					 
								by Pupil   »  Wed Nov 09, 2005 7:48 pm 
			
			
			
			
			Trond wrote: Chris wrote: A variable can't begin by a number.
So then it should give the error "not a valid variable" and not "not a valid decimal number", shouldn't it?
The error is correct as it is, because "3thing" is not a valid decimal number, or do you dissagree? 
 
			
			
									
									
						 
		 
				
		
		 
	 
	
						
		
		
			
				
																			
								Trond 							 
						Always Here 			
		Posts:  7446  		Joined:  Mon Sep 22, 2003 6:45 pm 		
		
											Location:  Norway 
							
						
		 
		
						
						
						 
			 
													
							
						
									
						Post 
					 
								by Trond   »  Wed Nov 09, 2005 8:41 pm 
			
			
			
			
			Pupil wrote: Trond wrote: Chris wrote: A variable can't begin by a number.
So then it should give the error "not a valid variable" and not "not a valid decimal number", shouldn't it?
The error is correct as it is, because "3thing" is not a valid decimal number, or do you dissagree? 
The error message doesn't say _what_ isn't a valid decimal number.
 
			
			
									
									
						 
		 
				
		
		 
	 
	
						
		
		
			
				
																			
								Polo 							 
						Addict 			
		Posts:  2422  		Joined:  Tue May 06, 2003 5:07 pm 		
		
											Location:  UK 
							
						
		 
		
						
						
						 
			 
													
							
						
									
						Post 
					 
								by Polo   »  Wed Nov 09, 2005 8:52 pm 
			
			
			
			
			3thing=128
128 is a "valid decimal number"
so "3thing" is the "not valid decimal number", but here it's a variable, so something's wrong somewhere.
 
			
			
									
									
						 
		 
				
		
		 
	 
	
						
		
		
			
				
																			
								Pupil 							 
						Enthusiast 			
		Posts:  715  		Joined:  Fri Apr 25, 2003 3:56 pm 		
		
						
						
		 
		
						
						
						 
			 
													
							
						
									
						Post 
					 
								by Pupil   »  Wed Nov 09, 2005 8:59 pm 
			
			
			
			
			Trond wrote: The error message doesn't say _what_ isn't a valid decimal number.
Well, it's fairly obvious, isn't it? 
 
However i agree that it would help if the compiler was a tad more explicit. An error message like the one below would've been more helpfull in pinpointing the problem:
"'3thing' is not a vaild decimal number."
 
			
			
									
									
						 
		 
				
		
		 
	 
	
						
		
		
			
				
																			
								Trond 							 
						Always Here 			
		Posts:  7446  		Joined:  Mon Sep 22, 2003 6:45 pm 		
		
											Location:  Norway 
							
						
		 
		
						
						
						 
			 
													
							
						
									
						Post 
					 
								by Trond   »  Wed Nov 09, 2005 9:01 pm 
			
			
			
			
			Pupil wrote: Trond wrote: The error message doesn't say _what_ isn't a valid decimal number.
Well, it's fairly obvious, isn't it? 
Try to type in 3thing on a line by itself. 
 Also, "=" isn't a valid decimal number.
The thing is: It reports that it got something which wasn't a valid decimal number at a place where it shouldn't expect a valid decimal number.
 
			
			
									
									
						 
		 
				
		
		 
	 
	
						
		
		
			
				
																			
								Pupil 							 
						Enthusiast 			
		Posts:  715  		Joined:  Fri Apr 25, 2003 3:56 pm 		
		
						
						
		 
		
						
						
						 
			 
													
							
						
									
						Post 
					 
								by Pupil   »  Wed Nov 09, 2005 9:15 pm 
			
			
			
			
			Polo wrote: 3thing=128
128 is a "valid decimal number"
so "3thing" is the "not valid decimal number", but here it's a variable, so something's wrong somewhere.
Well it isn't a variable, is it! Why, because it doesn't follow PB's naming convention for variables. 
Everything that starts with a number is considered to be a decimal of some sort by the compiler. if a non-numerical character(except operators and whitespace) is encountered in a character stream that starts with a numerical it's considered a non-valid number. That you perceive things differently can't be blamed on the compiler (Fred hasn't implemented the mind-reading code into the compiler yet). 
 
			
			
									
									
						 
		 
				
		
		 
	 
	
						
		
		
			
				
																			
								Pupil 							 
						Enthusiast 			
		Posts:  715  		Joined:  Fri Apr 25, 2003 3:56 pm 		
		
						
						
		 
		
						
						
						 
			 
													
							
						
									
						Post 
					 
								by Pupil   »  Wed Nov 09, 2005 9:26 pm 
			
			
			
			
			Trond wrote: Try to type in 3thing on a line by itself. 
 Also, "=" isn't a valid decimal number.
Already tried that, your point being?
Yes '=' isn't a valid decimal number, however it's a valid operator, but hopefully you already knew that.. 
 
The thing is: It reports that it got something which wasn't a valid decimal number at a place where it shouldn't expect a valid decimal number.
Exactly why shouldn't it expect a decimal number here?
 
			
			
									
									
						 
		 
				
		
		 
	 
	
						
		
		
			
				
																			
								Polo 							 
						Addict 			
		Posts:  2422  		Joined:  Tue May 06, 2003 5:07 pm 		
		
											Location:  UK 
							
						
		 
		
						
						
						 
			 
													
							
						
									
						Post 
					 
								by Polo   »  Wed Nov 09, 2005 9:37 pm 
			
			
			
			
			well, sorry, but "3thing" should be reported as a wrong variable name, then 
I just think it's not supported because Fred hasn't made the parser accept it, I think in other language using "3thing" is possible, come on, Fred, it's not that this is a really big feature we want, but it would make the language better