you should pratice and figure it out yourself(it will help you in the future rather than you depend on others). if you agree then look or study my example but do not copy it. or maybe build up a program yourself and allow my program to help you for reference.
just dont copy it and paste to your game because it wont help you in the future and/or your game is going to give you more problems. trust me, it happened to me by copying the tutorial's code.
just pop it in and it will run without problems.
sync on
sync rate 30
make object cube 1,1
do
ay#=object angle y(1)
if rightkey()=1 then turn#=turn#+.2
if leftkey()=1 then turn#=turn#-.2
if turn#>.1 then turn#=turn#-.1
if turn#<-.1 then turn#=turn#+.1
if leftkey()=0 and rightkey()=0 and turn#<.1 and turn#>-.1 then turn#=0
yrotate object 1,wrapvalue(ay#+turn#)
set cursor 0,0
sync
loop