Guess the number: Difference between revisions

no edit summary
m (syntax highlighting fixup automation)
No edit summary
Line 1,565:
7 is correct. Well guessed!
</pre>
 
=={{header|FutureBasic}}==
<syntaxhighlight lang="futurebasic">
void local fn BuildWindow
window 1, @"Guess the number (1-10)", (0,0,480,270), NSWindowStyleMaskTitled
textfield 1,,, (220,124,40,21)
ControlSetAlignment( 1, NSTextAlignmentCenter )
WindowMakeFirstResponder( 1, 1 )
AppSetProperty( @"Number", @(rnd(10)) )
end fn
 
void local fn DoDialog( ev as long, tag as long )
select ( ev )
case _btnClick
select ( tag )
case 1
if ( fn ControlIntegerValue( 1 ) == fn NumberIntegerValue( fn AppProperty( @"Number" ) ) )
alert 1,, @"Well guessed!",, @"Exit"
end
else
textfield 1,, @""
alert 1,, @"Wrong number!",, @"Try again"
end if
end select
end select
end fn
 
fn BuildWindow
 
on dialog fn DoDialog
 
HandleEvents
</syntaxhighlight>
 
=={{header|Gambas}}==
416

edits