You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description of the problem: const is not recognised as keyword Steps to reproduce:
See below Code:
Source Code
constMAX_15B=1<<15constMAX_16B=1<<16funcunsigned16_to_signed(unsigned):
return (unsignedMAX_15B) %MAX_16B-MAX_15Bfunc_ready():
varf=File.new()
f.open(user://file.dat, File.WRITE_READ)
f.store_16(-42) # This wraps around and stores 65494 (2^16 - 42).f.store_16(121) # In bounds, will store 121.f.seek(0) # Go back to start to read the stored value.varread1=f.get_16() # 65494varread2=f.get_16() # 121varconverted1=unsigned16_to_signed(read1) # -42varconverted2=unsigned16_to_signed(read2) # 121
Output
[codeblocks][gdscript]const MAX_15B =1<<15const MAX_16B =1<<16
func unsigned16_to_signed(unsigned):return(unsignedMAX_15B)% MAX_16B - MAX_15B
func _ready():
var f =File.new()
f.open(user://file.dat, File.WRITE_READ)
f.store_16(-42) # This wraps around and stores 65494(2^16-42).
f.store_16(121) # In bounds, will store 121.
f.seek(0) # Go back to start to read the stored value.
var read1 = f.get_16() # 65494var read2 = f.get_16() # 121var converted1 = unsigned16_to_signed(read1) # -42
var converted2 = unsigned16_to_signed(read2) # 121[/gdscript][csharp]
Const Max15b =1<<15;ConstMax16b=1<<16;publicvoidUnsigned16ToSigned(?TYPE?unsigned){return(unsignedMAX_15B)%MAX_16B-MAX_15B;}publicoverridevoid_Ready(){varf=new File();
f.Open(user://file.dat, File.WRITE_READ);
f.Store16()-42);// This wraps around and stores 65494 (2^16 - 42).
f.Store16(121);// In bounds, will store 121.
f.Seek(0);// Go back to start to read the stored value.?VAR?read1= f.Get16();// 65494?VAR?read2= f.Get16();// 121?VAR?converted1= Unsigned16ToSigned(read1);// -42?VAR?converted2= Unsigned16ToSigned(read2);// 121}[/csharp][/codeblocks]
Expected Output
Warnings
[4] No return value provided. Assuming void. Use -> RETVAL to specify[4] No type provided. Consider type hinting with NAME:TYPE[5] If constant is enum refer to documentation for correct syntax.[5] If constant is enum refer to documentation for correct syntax.[5] If constant is enum refer to documentation for correct syntax.[7] No return value provided. Assuming void. Use -> RETVAL to specify[9] If constant is enum refer to documentation for correct syntax.[10] If constant is enum refer to documentation for correct syntax.[13] Type of declaration is unknown[14] Type of declaration is unknown[15] Type of declaration is unknown[16] Type of declaration is unknown
The text was updated successfully, but these errors were encountered:
Version: 0.7-dev (Last Build 2020-09-13 01:30)
Description of the problem:
const
is not recognised as keywordSteps to reproduce:
See below
Code:
Source Code
Output
Expected Output
Warnings
The text was updated successfully, but these errors were encountered: