hello nice to be here i'm new here

new topic     » topic index » view thread      » older message » newer message

hello nice to be here with you all...

I'm ron I'm from Israel a hobby programmer I've started learning to code and to program 7 or 8 years ago I started with vb.net, then tried other languages such as python and javascript in the last few years I've been mostly programming in BASIC languages such as QB64 and freeBASIC but also a bit of C or Cpp i consider myself to be a bit of a "retro" coder - I have known about euphoria programming language since I heard about it 2 years ago but just now I decided to learn it well and get to code in it - I find it a good programming language not too hard but efficient and I'm curious to learn more as much as I can about it... I'm on a linux 64 bit OS and the instillation was very easy I use Geany IDE to run and compile it if necessary - I'm still at the very basic but I hope I can learn fast it since I'm familiar with basic syntax and C Cpp syntax

anyway here are two small code I coded today as a test run for euphoria :)

include std/console.e 
--include std/get.e 
 
--with trace 
--trace(1) 
 
procedure main() 
    integer target = rand(100) 
    integer guess 
    integer attempts = 0 
    --printf(1, "number is: %d\n\n", target) 
    atom true = 1 
    while true = 1 do 
        printf(1, "Guess a number between 1 and 100: ") 
        guess = prompt_number("", {1, 100}) 
        attempts += 1 
         
        if guess < target then 
            puts(1, "Too low! Try again.") 
        elsif guess > target then 
            puts(1, "Too high! Try again.") 
        else 
            printf(1, "Congratulations! You guessed the number in %d attempts.", attempts ) 
            true = 0 
        end if 
    end while 
end procedure 
 
main() 
include std/console.e 
 
procedure main() 
    sequence user_input="" 
    sequence response ="" 
     
    puts(1,"Hello! I'm your chatbot. Ask me something or say 'exit' to quit.") 
    atom true = 1 
    while true = 1 do 
        printf(1, "\nYou: ") 
        --gets(user_input) 
        --user_input = user_input[1..length(user_input)-1] 
         
        user_input = prompt_string("") 
         
        if equal(user_input, "exit") then 
            puts(1,"Chatbot: Goodbye!") 
            true = 0 
        elsif equal(user_input, "hello") then 
            response = "Hi there!" 
        elsif equal(user_input, "how are you") then 
            response = "I'm just a program, but thanks for asking!" 
        elsif equal(user_input, "what's your name") then 
            response = "I'm ChatEuphoria, your friendly Euphoria chatbot!" 
        else 
            response = "I'm not sure how to respond to that." 
        end if 
         
        printf(1, "Chatbot: %s\n", {response}) 
    end while 
end procedure 
 
main() 
new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu