
-----------------------------------
cheese188
Wed Apr 08, 2009 7:52 pm

can i make a basic unkown int?
-----------------------------------
if i had the variable

var n : int
n :=                %how can i make n unkown




   :vi: just thought id put that in cause it looks cool


Mod Edit: Remember to use syntax tags! Thanks :) Code Here

-----------------------------------
saltpro15
Wed Apr 08, 2009 7:57 pm

RE:can i make a basic unkown int?
-----------------------------------
what do you mean by unknown? like a random number? if so, use

var num := Rand.Int (1,100)

for example, that will create a random integer between 1 and 100

-----------------------------------
cheese188
Wed Apr 08, 2009 8:07 pm

Re: can i make a basic unkown int?
-----------------------------------
not really i need like an integer that can be anything a user enters so i can use it in an if statement
with another integer like

code:
var n : int
n := Rand.Int (1, 3)

var g : int
g := %this is the part I am confused about

if n = 1 then
   put "kauf" ..      
   get g
end if

if g = n then
   put "jadg"
end if

kind of like a question, if n = 1 then it say's kauf then whoever enters g 
then if the g they entered is the same as n then it say's jadg
what i need to know is how to make g 3 different values or any value
hope i explained it well enough[syntax=""][/syntax]

-----------------------------------
saltpro15
Wed Apr 08, 2009 8:30 pm

RE:can i make a basic unkown int?
-----------------------------------
what's with all the extra brackets? I don't think they're necessary...

just use a get statement
[code]
var n : int
get n
if n = 1 then
%do something
elsif n = 2 then
% do something else
[/code]

-----------------------------------
cheese188
Wed Apr 08, 2009 8:36 pm

Re: can i make a basic unkown int?
-----------------------------------
oh its so simple i did not think of putting a get statement before if statement
thanks a lot that's going to complete my program

-----------------------------------
saltpro15
Wed Apr 08, 2009 8:38 pm

RE:can i make a basic unkown int?
-----------------------------------
no problem

-----------------------------------
Siavash
Sat Apr 11, 2009 7:35 am

RE:can i make a basic unkown int?
-----------------------------------
I do 

var n :int
randint (n, 0, 10000)

