Simple question:
println(hello);
or
println!(hello!);
Why (or when) should we use one or the other form?? Differences?
Regards.
___
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev
, which can only
be done with macros in rust.
jack.
On Fri, Mar 14, 2014 at 3:52 PM, Renato Lenzi rex...@gmail.com wrote:
Simple question:
println(hello);
or
println!(hello!);
Why (or when) should we use one or the other form?? Differences?
Regards
Always talking about read write i noticed another interesting thing:
use std::io::buffered::BufferedReader;
use std::io::stdin;
fn main()
{
print!(Insert your name: );
let mut stdin = BufferedReader::new(stdin());
let s1 = stdin.read_line().unwrap_or(~nothing);
print!(Welcome,
I would like to manage user input for example by storing it in a string. I
found this solution:
use std::io::buffered::BufferedReader;
use std::io::stdin;
fn main()
{
let mut stdin = BufferedReader::new(stdin());
let mut s1 = stdin.read_line().unwrap_or(~nothing);
print(s1);
}
It
patterns having shortcuts here and there!
On Sat, Feb 8, 2014 at 3:06 PM, Renato Lenzi rex...@gmail.com wrote:
I would like to manage user input for example by storing it in a string.
I
found this solution:
use std::io::buffered::BufferedReader;
use std::io::stdin;
fn main()
{
let
If i want to access line command params i used code like this:
fn main() {
let args: ~[~str] = ::std::os::args();
println(args[0]);
}
Is this the best way to play with such params or the best is using
print_args? i've found no examples using print_args
thanks, regards.
The code is trivial:
fn main()
{
let x = 3;
println(x.to_str());
}
the error is this (on Win7)
d:\Rust09\binrustc 00025.rs
00025.rs:4:11: 4:22 error: multiple applicable methods in scope
00025.rs:4 println(x.to_str());
^~~
00025.rs:4:11: 4:22
Good documentation is crucial for the success of a language. Some friends
of mine simply ceased their efforts on a language due to lack of good docs
about it. There are examples: excellent languages, as Falcon, Gosu, Fantom,
probably do not have sufficient resources to produce what their value
for me
thx a lot.
On 27.09.2013 15:09, Renato Lenzi wrote:
Strange thing...
after installing rust 08 on W7 System rustc.exe (or rust.exe or
rusti.exe) doesn't start and Windows complains:
the application was unable to start correctly (0xc005).
The worst thing
version that Rust binaries
require.
You can then copy libgcc_s_dw2-1.dll, libstdc++-6.dll and libpthread-2.dll
from %mingw%\bin into Rust installation directory and run mingw-get
upgrade to go back to latest versions.
Vadim
On Fri, Sep 27, 2013 at 6:09 AM, Renato Lenzi rex...@gmail.com wrote
Is it possibile, or will be possibile, to use default parameters and/or
named parameters in Rust?
In the docs i couldn't find anything about this (may be my fault...)
Regards.
___
Rust-dev mailing list
Rust-dev@mozilla.org
Yes, this is a smart workaround. i hope we will have something better
in Rust but this a good answer to this need.
Regards,
On 07/09/13 22:11, Renato Lenzi wrote:
Is it possibile, or will be possibile, to use default parameters and/or
named parameters in Rust?
In the docs i couldn't
Hi there. I've installed Rust 7 on Windows 7. I'm trying to compile this
simple code:
fn sum (x: int, y : int) - int
{
x + y
}
fn main()
{
let x =sum(2, 3);
io::println(int::to_str(x));
}
but i get:
00015.rs:9:13: 9:24 error: unresolved name
00015.rs:9 io::println(int::to_str(x));
with
fot int::range(low,hi)
i can loop from low to h1-1
with
for int::range_step(low, hi, step)
i can loop for low to hi-1 with step step
with
for int::range_rev(hi, low)
i can loop from hi to low, reverse mode
but... how can loop from hi to low with step other than 1? range_rev_step
is
I don't understand why this code is bad:
let n1 = int::from_str(line);
if n1 == 0
compiler complains:
3.rs:7:12: 7:13 error: mismatched types: expected
`core::option::Optionint
` but found `VI0` (expected enum core::option::Option but found integral
varia
ble)
3.rs:7if n1 == 0
Hi there.
How can i cast from int to float?
that is:
let x = 3
let mut f = 3.0
f = f * x
this doesn't work... i have to change from int to float... is this possible?
Thx in advance.
___
Rust-dev mailing list
Rust-dev@mozilla.org
Hi there. How can i use power operator?
that is:
let x1 = 7;
let x2 = 8;
let mut x3;
x3 = x1 ** x2; ? it seems this doesn't work
thx.
___
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev
17 matches
Mail list logo