Determine sentence type: Difference between revisions
FutureBasic solution added
(added Easylang) |
(FutureBasic solution added) |
||
Line 488:
wend</syntaxhighlight>
{{out}}<pre>Q
S
E
N
</pre>
=={{header|FutureBasic}}==
<syntaxhighlight lang="futurebasic">
local fn SentenceType( sentence as CFStringRef ) as CFStringRef
CFStringRef type
select ( fn StringCharacterAtIndex( sentence, len(sentence)-1 ) )
case _"?" : type = @"Q"
case _"." : type = @"S"
case _"!" : type = @"E"
case else : type = @"N"
end select
end fn = type
print fn SentenceType( @"hi there, how are you today?" )
print fn SentenceType( @"I'd like to present to you the washing machine 9001." )
print fn SentenceType( @"You have been nominated to win one of these!" )
print fn SentenceType( @"Just make sure you don't break it" )
HandleEvents
</syntaxhighlight>
{{output}}
<pre>
Q
S
E
|