mirror of
				https://github.com/godotengine/godot.git
				synced 2025-10-30 21:21:10 +00:00 
			
		
		
		
	
		
			
	
	
		
			34 lines
		
	
	
	
		
			521 B
		
	
	
	
		
			GDScript3
		
	
	
	
	
	
		
		
			
		
	
	
			34 lines
		
	
	
	
		
			521 B
		
	
	
	
		
			GDScript3
		
	
	
	
	
	
|   | func foo(x): | ||
|  | 	match x: | ||
|  | 		["value1"]: | ||
|  | 			print('["value1"]') | ||
|  | 		["value1", "value2"]: | ||
|  | 			print('["value1", "value2"]') | ||
|  | 
 | ||
|  | func bar(x): | ||
|  | 	match x: | ||
|  | 		[ | ||
|  | 			"value1" | ||
|  | 		]: | ||
|  | 			print('multiline ["value1"]') | ||
|  | 		[ | ||
|  | 			"value1", | ||
|  | 			"value2", | ||
|  | 		]: | ||
|  | 			print('multiline ["value1", "value2",]') | ||
|  | 		[ | ||
|  | 			"value1", | ||
|  | 			[ | ||
|  | 				"value2", | ||
|  | 				.., | ||
|  | 			], | ||
|  | 		]: | ||
|  | 			print('multiline ["value1", ["value2", ..,],]') | ||
|  | 
 | ||
|  | func test(): | ||
|  | 	foo(["value1"]) | ||
|  | 	foo(["value1", "value2"]) | ||
|  | 	bar(["value1"]) | ||
|  | 	bar(["value1", "value2"]) | ||
|  | 	bar(["value1", ["value2", "value3"]]) |